API Fetcher Bot Implementation: All Time High Indicator and Plotter implemented and tested.
This commit is contained in:
1 parent
c19b7d0190
commit
abd4b605b5
7 files changed
+107
-13
No files matched your search
@@ -1 +1 @@
|
||||
{"type":"Workspace","name":"API Fetcher Demo","rootNodes":[{"type":"Network","name":"My Network","project":"Superalgos","networkNodes":[{"type":"Network Node","name":"My Computer","config":"{ \n\"host\": \"localhost\", \n\"webPort\": \"34248\", \n\"webSocketsPort\": \"18041\"\n}","project":"Superalgos","dataTasks":{"type":"Data Tasks","name":"New Data Tasks","project":"Superalgos","projectDataTasks":[{"type":"Project Data Tasks","name":"Superalgos","project":"Superalgos","exchangeDataTasks":[{"type":"Exchange Data Tasks","name":"Binance","project":"Superalgos","marketDataTasks":[{"type":"Market Data Tasks","name":"Binance BTC/USDT","project":"Superalgos","dataMineTasks":[{"type":"Data Mine Tasks","name":"Masters","project":"Superalgos","taskManagers":[{"type":"Task Manager","name":"Masters","project":"Superalgos","tasks":[{"type":"Task","name":"Exchange Raw Data","project":"Superalgos","bot":{"type":"Sensor Bot Instance","name":"Exchange Raw Data","config":"{\n \"startDate\": \"2020-01-01\"\n}","project":"Superalgos","processes":[{"type":"Sensor Process Instance","name":"Exchange Raw Data Historic-OHLCVs","project":"Superalgos","id":"407b3902-312f-4074-a7b2-f4e9ce72db07","savedPayload":{"position":{"x":23468.38111670686,"y":30308.75940440786},"targetPosition":{"x":23685.50132813838,"y":30101.73570096323},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Historic-OHLCVs","id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc"}}}],"id":"4b5fb696-c41e-4cf0-92e2-e5a64a3871e4","savedPayload":{"position":{"x":23685.50132813838,"y":30101.73570096323},"targetPosition":{"x":23902.6215395699,"y":29894.711997518596},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"a5933e2f-5aa8-45dd-8f13-e50a42b795b2","savedPayload":{"position":{"x":23902.6215395699,"y":29894.711997518596},"targetPosition":{"x":24119.74175100142,"y":29687.688294073963},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Webhooks","project":"Superalgos","bot":{"type":"Sensor Bot Instance","name":"Webhooks","config":"{ \n\"startDate\": \"2020-01-01\"\n}","project":"Superalgos","processes":[{"type":"Sensor Process Instance","name":"Webhooks Check-Webhook","project":"Superalgos","id":"c5bc3847-e5b9-4345-92a7-319b3248a40e","savedPayload":{"position":{"x":23319.78984721199,"y":30100.092163628633},"targetPosition":{"x":23586.440481808466,"y":29962.62420711041},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Check-Webhook","id":"69f37820-ab16-4e19-bfd8-386dd6e249a3"}}}],"id":"64cef381-ea35-4f33-bb53-8e06ea009225","savedPayload":{"position":{"x":23586.440481808466,"y":29962.62420711041},"targetPosition":{"x":23853.091116404943,"y":29825.156250592187},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"d3837a8f-361a-4a28-9691-e0afac2fb8f0","savedPayload":{"position":{"x":23853.091116404943,"y":29825.156250592187},"targetPosition":{"x":24119.74175100142,"y":29687.688294073963},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Candles Volumes","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"Candles Volumes","config":"{ \n\"parameter1\": \"Value for parameter1 defined at the Product Definition\"\n}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Market","project":"Superalgos","id":"1e1ea090-43a5-457e-ac5a-d8c23e242b03","savedPayload":{"position":{"x":23260.73799407062,"y":29932.322394401017},"targetPosition":{"x":23530.5845326438,"y":29801.23904069021},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"9f683143-a33f-42c1-9fa8-c601f01ee4e1"}}},{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Daily","project":"Superalgos","id":"3bb72ff9-6ce3-42ac-86c5-33f6a3e980c3","savedPayload":{"position":{"x":23231.348898260723,"y":29779.83728573044},"targetPosition":{"x":23530.5845326438,"y":29801.23904069021},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiLine truncated
|
||||
{"type":"Workspace","name":"API Fetcher Demo","rootNodes":[{"type":"Network","name":"My Network","project":"Superalgos","networkNodes":[{"type":"Network Node","name":"My Computer","config":"{ \n\"host\": \"localhost\", \n\"webPort\": \"34248\", \n\"webSocketsPort\": \"18041\"\n}","project":"Superalgos","dataTasks":{"type":"Data Tasks","name":"New Data Tasks","project":"Superalgos","projectDataTasks":[{"type":"Project Data Tasks","name":"Superalgos","project":"Superalgos","exchangeDataTasks":[{"type":"Exchange Data Tasks","name":"Binance","project":"Superalgos","marketDataTasks":[{"type":"Market Data Tasks","name":"Binance BTC/USDT","project":"Superalgos","dataMineTasks":[{"type":"Data Mine Tasks","name":"Masters","project":"Superalgos","taskManagers":[{"type":"Task Manager","name":"Masters","project":"Superalgos","tasks":[{"type":"Task","name":"Exchange Raw Data","project":"Superalgos","bot":{"type":"Sensor Bot Instance","name":"Exchange Raw Data","config":"{ \n\"startDate\": \"2020-01-01\"\n}","project":"Superalgos","processes":[{"type":"Sensor Process Instance","name":"Exchange Raw Data Historic-OHLCVs","project":"Superalgos","id":"de1b311f-5a2e-475e-a013-ff9bf81040db","savedPayload":{"position":{"x":23219.74175100142,"y":29687.688294073963},"targetPosition":{"x":23519.74175100142,"y":29687.688294073963},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true},"referenceParent":{"type":"Process Definition","name":"Historic-OHLCVs","id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc"}}}],"id":"60dd9ff6-0240-4c42-b9b4-7564a3d9ba11","savedPayload":{"position":{"x":23519.74175100142,"y":29687.688294073963},"targetPosition":{"x":23819.74175100142,"y":29687.688294073963},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"06a29ced-2d0a-449d-9acb-e92c293f67f8","savedPayload":{"position":{"x":23819.74175100142,"y":29687.688294073963},"targetPosition":{"x":24119.74175100142,"y":29687.688294073963},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true}}},{"type":"Task","name":"Candles Volumes","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"Candles Volumes","config":"{ \n\"parameter1\": \"Value for parameter1 defined at the Product Definition\"\n}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Market","project":"Superalgos","id":"a8499fe8-a233-4b13-811b-8b34ebaea826","savedPayload":{"position":{"x":23607.609716645457,"y":28955.941017447334},"targetPosition":{"x":23819.74175100142,"y":29168.073051803298},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"9f683143-a33f-42c1-9fa8-c601f01ee4e1"}}},{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Daily","project":"Superalgos","id":"fab839a8-34bc-461f-bee9-4515480930f3","savedPayload":{"position":{"x":23742.096037470663,"y":28878.295303916577},"targetPosition":{"x":23819.74175100142,"y":29168.073051803298},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"980ceb1d-7be6-454f-90d9-01ba1fd4a65d"}}}],"id":"64d9b2ad-3ef2-4e66-b63a-a2f9edaa7535","savedPayload":{"position":{"x":23819.74175100142,"y":29168.073051803298},"targetPosition":{"x":23969.74175100142,"y":29427.88067293863},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"ad3cb918-196e-488a-a8fc-6131732409d8","savedPayload":{"position":{"x":23969.74175100142,"y":29427.88067293863},"targetPosition":{"x":24119.74175100142,"y":29687.688294073963},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true}}}],"id":"bc03b3cc-1836-4c20-9ac2-361b7eb0becf","savedPayload":{"position":{"x":24119.74175100142,"y":29687.688294073963},"targetPosition":{"x":24379.549372136753,"y":29837.688294073963},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true}}}],"id":"2dc6e7aa-78ac-4b70-be65-56e1498b580c","savedPayload":{"position":{"x":24379.549372136753,"y":29837.688294073963},"targetPosition":{"x":24639.356993272086,"y":29987.688294073963},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapseLine truncated
|
||||
@@ -28,7 +28,8 @@
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "codeName is the name of the dataset as used within the code."
|
||||
"text": "codeName is the name of the dataset as used within the code. 'Single-File'is a special value. Use it for datasets that do not depend on Time Frames and that have a timestamp Record Property instead of the regular Begin and End. When this type of datasets are a dependency of Market or Daily datasets, they need the codeName'Single-File'in order to be found on disk.",
|
||||
"updated": 1621100190528
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
|
||||
@@ -199,6 +199,26 @@
|
||||
"text": "If you did install Git and you are experiencing the issue described above, restarting your PC may help things sort themselves out.",
|
||||
"updated": 1610910739376
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Linux and iOS",
|
||||
"updated": 1621085154588
|
||||
},
|
||||
{
|
||||
"style": "Success",
|
||||
"text": "Input your personal authentication token (PAT) in place of your password and hit enter. ",
|
||||
"updated": 1621085095513
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "If you don't want to keep entering in your token then you can have git cach your credentials:",
|
||||
"updated": 1621085196186
|
||||
},
|
||||
{
|
||||
"style": "Link",
|
||||
"text": "How to Cache your Git Credentials->docs.github.com/en/github/getting-started-with-github/caching-your-github-credentials-in-git",
|
||||
"updated": 1621085386878
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": ""
|
||||
|
||||
+32
-3
@@ -74,9 +74,19 @@
|
||||
"style": "Text",
|
||||
"text": "Data collections of different products may begin and end at different points in time. For example, it takes 20 candles to build the first bollingerBands object of the Bollinger Bands indicator, or 200 candles to build the first popularSMAs object of the SMA indicator. Therefore, the record in i position in the array of one product may not correspond to the same period of time of the record in the same position of a different product."
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "getElement Function"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "To overcome that hurdle, the getElement function, which takes two parameters, may be used:"
|
||||
"text": "This function allows users to locate an object at a dataset whose objects does not have a begin and end property but instead, they have a timestamp property. It receives an arbitrary begin / end object and the function will search within the dependency dataset for the first record whose timestamp is whitin the begin and end of the received reference objet. For example, a user can get the News record that belong to a certain Candle object.",
|
||||
"updated": 1621105823745
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The getElement function, which takes two parameters, may be used:",
|
||||
"updated": 1621105837484
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
@@ -96,8 +106,27 @@
|
||||
},
|
||||
{
|
||||
"style": "Javascript",
|
||||
"text": "let candle = record.current // Calling \"Candles\"\nlet basicCandle = getElement ('basicCandles', candle) // Calling \"Basic Candles\"",
|
||||
"updated": 1611430980056
|
||||
"text": "let candle = record.current // Calling \"Candles\"\nlet basicCandle = getElement ('basicCandles', candle) // Calling \"Basic Candles\"",
|
||||
"updated": 1621105552115
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "getTimestampElement Function",
|
||||
"updated": 1621105629181
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Indicators might have parameters that influences it's calculations. These parameters are defined at the Product Definition config, and their values are set at the Process Instance config. Parameters are extracted at the Procedure Initialization Code. In order to facilitate this extraction we will create an object here that will be accesed from the Procedure Initialization with all parameters and their defined values.",
|
||||
"updated": 1621105691314
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": ""
|
||||
},
|
||||
{
|
||||
"style": "Javascript",
|
||||
"text": "let currentAssetMetrics = getTimestampElement('assetMetrics', record.current)",
|
||||
"updated": 1621105716567
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
|
||||
@@ -651,12 +651,12 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
2) It was calculated automatically.
|
||||
*/
|
||||
|
||||
let nodePath = recordProperty.config.nodePath
|
||||
|
||||
let nodePath = recordProperty.config.nodePath
|
||||
|
||||
if (nodePath === undefined) {
|
||||
nodePath = recordPropertiesNodePathMap.get(recordProperty.config.codeName)
|
||||
}
|
||||
|
||||
|
||||
let value = eval(nodePath)
|
||||
|
||||
if (recordProperty.config.isDate === true) {
|
||||
@@ -666,7 +666,14 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
/*
|
||||
Check that we do not accept values that will break the JSON format of the file.
|
||||
*/
|
||||
if (isNaN(value)) { value = 0 }
|
||||
if (recordProperty.config.isString !== true && recordProperty.config.isBoolean !== true) {
|
||||
/*
|
||||
At this point Dates have been converted to numbers, so if the Record Property is not a string
|
||||
then it must be a number.
|
||||
*/
|
||||
if (isNaN(value)) { value = 0 }
|
||||
}
|
||||
|
||||
if (value === null || value === undefined) { value = 0 }
|
||||
record.values.push(value)
|
||||
record.headers.push(recordProperty.config.codeName)
|
||||
|
||||
@@ -75,7 +75,17 @@
|
||||
|
||||
function getFile() {
|
||||
let fileName = "Data.json";
|
||||
let filePath = dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + timeFrameLabel;
|
||||
let filePath
|
||||
|
||||
/*
|
||||
For datasets that are not dependent on a Time Frame we will build the file path without the timeFrameLabel
|
||||
*/
|
||||
if (dependency.referenceParent.config.codeName === "Single-File") {
|
||||
filePath= dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName
|
||||
} else {
|
||||
filePath= dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + timeFrameLabel
|
||||
}
|
||||
|
||||
datasetModule.getTextFile(filePath, fileName, onFileReceived)
|
||||
|
||||
function onFileReceived(err, text) {
|
||||
|
||||
@@ -335,17 +335,44 @@
|
||||
let dataDependencyMap = new Map()
|
||||
for (let j = 0; j < dataDependecyArray.length; j++) {
|
||||
let record = dataDependecyArray[j]
|
||||
let key = record.begin.toString() + '-' + record.end.toString()
|
||||
dataDependencyMap.set(key, record)
|
||||
let key
|
||||
if (record.begin !== undefined && record.end !== undefined) {
|
||||
key = record.begin.toString() + '-' + record.end.toString()
|
||||
dataDependencyMap.set(key, record)
|
||||
} else {
|
||||
/*
|
||||
Datasets with objects that do not have a begin and end can not be part of the map.
|
||||
*/
|
||||
}
|
||||
}
|
||||
dataDependencies[dataDependencyName] = dataDependencyMap
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This function allows users to locate an object at a dataset based on the begins and end properties
|
||||
of another object provided to the function as a parameter. For example, users can localte the
|
||||
bollinger band object that has the same begin and end than a candle object.
|
||||
*/
|
||||
function getElement(dependencyName, currentRecordPrimaryDataDependency) {
|
||||
let key = currentRecordPrimaryDataDependency.begin.toString() + '-' + currentRecordPrimaryDataDependency.end.toString()
|
||||
return dataDependencies[dependencyName].get(key)
|
||||
}
|
||||
/*
|
||||
This function allows users to locate an object at a dataset whose objects does not have a begin and end
|
||||
property but instead, they have a timestamp property. It receives an arbitrary begin / end object and
|
||||
the function will search within the dependency dataset for the first record whose timestamp is whitin
|
||||
the begin and end of the received reference objet. For example, a user can get the News record that belong
|
||||
to a certain Candle object.
|
||||
*/
|
||||
function getTimestampElement(dependencyName, currentRecordPrimaryDataDependency) {
|
||||
let dependencyArray = products[dependencyName]
|
||||
for (let i = 0; i < dependencyArray.length; i++) {
|
||||
let record = dependencyArray[i]
|
||||
if (record.timestamp >= currentRecordPrimaryDataDependency.begin && record.timestamp <= currentRecordPrimaryDataDependency.end) {
|
||||
return record
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Indicators might have parameters that influences it's calculations. These parameters
|
||||
|
||||
Reference in new issue
Block a user