Refactoring and Bug Fixes

This commit is contained in:
Luis Fernando Molina committed 2020-10-31 21:08:57 +01:00
1 parent c94f7fc747
commit c877072b7c
14 files changed
+425 -399

No files matched your search

@@ -112,8 +112,9 @@ function newChartingSpaceFunctions() {
function createTimeMachine(dashboard, session, market, networkNode, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter) {
let mineProducts
let timeMachine = functionLibraryUiObjectsFromNodes.addUIObject(dashboard, 'Time Machine')
let exchange = market.payload.parentNode.payload.parentNode
timeMachine.payload.referenceParent = session
timeMachine.name = session.name + ' ' + session.type + ' ' + networkNode.name
timeMachine.name = session.name + ' ' + session.type + ' ' + networkNode.name + ' ' + exchange.name + ' ' + market.name
timeMachine.payload.floatingObject.collapseToggle()
timeMachine.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
timeMachine.timeFrameScale.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
@@ -1 +1 @@
{"type":"Workspace","name":"Exchange Keys Tests","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","dataMining":{"type":"Data Mining","name":"New Data Mining","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\": \"2017-01-01\"\n}","project":"Superalgos","processes":[{"type":"Sensor Process Instance","name":"Exchange Raw Data Historic-OHLCVs","project":"Superalgos","id":"f17f9567-af83-4292-a0dc-7c1c9dbf53b8","savedPayload":{"position":{"x":23993.925629940142,"y":29195.742554406977},"targetPosition":{"x":24261.227587196652,"y":29331.93970432884},"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":"9eaa4440-c8bc-4daa-b858-efa1845087de","savedPayload":{"position":{"x":24261.227587196652,"y":29331.93970432884},"targetPosition":{"x":24528.529544453162,"y":29468.136854250704},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"97e5a05e-9463-41a4-8255-a9487df56496","savedPayload":{"position":{"x":24528.529544453162,"y":29468.136854250704},"targetPosition":{"x":24795.831501709672,"y":29604.334004172568},"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":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Market","project":"Superalgos","id":"1ef6762d-a20c-46e0-8183-6aac6dd9073a","savedPayload":{"position":{"x":24447.0295945802,"y":28782.09892401185},"targetPosition":{"x":24610.421305084707,"y":29033.700094395477},"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":"7b44275e-9446-4807-b9c2-4ba1107a5295","savedPayload":{"position":{"x":24594.720518211823,"y":28734.111233969106},"targetPosition":{"x":24610.421305084707,"y":29033.700094395477},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"980ceb1d-7be6-454f-90d9-01ba1fd4a65d"}}}],"id":"78c835ef-be5b-4e74-8b0c-610afbbef304","savedPayload":{"position":{"x":24610.421305084707,"y":29033.700094395477},"targetPosition":{"x":24703.12640339719,"y":29319.017049284023},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"b4da2db7-fcae-4918-b38a-5e6966a9994b","savedPayload":{"position":{"x":24703.12640339719,"y":29319.017049284023},"targetPosition":{"x":24795.831501709672,"y":29604.334004172568},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Bollinger Bands","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"Bollinger Bands","config":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Bollinger Bands Multi-Period-Market","project":"Superalgos","id":"22a8694f-078e-4f1f-8470-7a7b25237397","savedPayload":{"position":{"x":25130.599308798726,"y":28776.285809439407},"targetPosition":{"x":25068.2258015534,"y":29069.730089659548},"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":"941a0543-0cc0-4a5d-a782-728d2835c100"}}}Line truncated
{"type":"Workspace","name":"Exchange Keys Tests","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","dataMining":{"type":"Data Mining","name":"New Data Mining","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\": \"2017-01-01\"\n}","project":"Superalgos","processes":[{"type":"Sensor Process Instance","name":"Exchange Raw Data Historic-OHLCVs","project":"Superalgos","id":"f17f9567-af83-4292-a0dc-7c1c9dbf53b8","savedPayload":{"position":{"x":23993.925629940142,"y":29195.742554406977},"targetPosition":{"x":24261.227587196652,"y":29331.93970432884},"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":"9eaa4440-c8bc-4daa-b858-efa1845087de","savedPayload":{"position":{"x":24261.227587196652,"y":29331.93970432884},"targetPosition":{"x":24528.529544453162,"y":29468.136854250704},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"97e5a05e-9463-41a4-8255-a9487df56496","savedPayload":{"position":{"x":24528.529544453162,"y":29468.136854250704},"targetPosition":{"x":24795.831501709672,"y":29604.334004172568},"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":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Market","project":"Superalgos","id":"1ef6762d-a20c-46e0-8183-6aac6dd9073a","savedPayload":{"position":{"x":24447.0295945802,"y":28782.09892401185},"targetPosition":{"x":24610.421305084707,"y":29033.700094395477},"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":"7b44275e-9446-4807-b9c2-4ba1107a5295","savedPayload":{"position":{"x":24594.720518211823,"y":28734.111233969106},"targetPosition":{"x":24610.421305084707,"y":29033.700094395477},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"980ceb1d-7be6-454f-90d9-01ba1fd4a65d"}}}],"id":"78c835ef-be5b-4e74-8b0c-610afbbef304","savedPayload":{"position":{"x":24610.421305084707,"y":29033.700094395477},"targetPosition":{"x":24703.12640339719,"y":29319.017049284023},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"b4da2db7-fcae-4918-b38a-5e6966a9994b","savedPayload":{"position":{"x":24703.12640339719,"y":29319.017049284023},"targetPosition":{"x":24795.831501709672,"y":29604.334004172568},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Bollinger Bands","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"Bollinger Bands","config":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Bollinger Bands Multi-Period-Market","project":"Superalgos","id":"22a8694f-078e-4f1f-8470-7a7b25237397","savedPayload":{"position":{"x":25130.599308798726,"y":28776.285809439407},"targetPosition":{"x":25068.2258015534,"y":29069.730089659548},"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":"941a0543-0cc0-4a5d-a782-728d2835c100"}}}Line truncated
@@ -1 +1 @@
{"type":"Workspace","name":"Getting Started","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","dataMining":{"type":"Data Mining","name":"New Data Mining","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":"d244c564-4e86-43c7-9796-dc3b6294ec8b","savedPayload":{"position":{"x":23993.925629940142,"y":29195.742554406977},"targetPosition":{"x":24261.227587196652,"y":29331.93970432884},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Historic-OHLCVs","id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc"}}}],"id":"343313ae-5705-484d-8bf8-aed25ba61cfa","savedPayload":{"position":{"x":24261.227587196652,"y":29331.93970432884},"targetPosition":{"x":24528.529544453162,"y":29468.136854250704},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"a8f38508-1cac-4ab1-815f-d338fc813377","savedPayload":{"position":{"x":24528.529544453162,"y":29468.136854250704},"targetPosition":{"x":24795.831501709672,"y":29604.334004172568},"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":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Market","project":"Superalgos","id":"f0ef12ed-f0fd-4b88-8e15-27cf24265a5f","savedPayload":{"position":{"x":24387.47785744149,"y":28832.96091248782},"targetPosition":{"x":24610.421305084707,"y":29033.700094395477},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"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":"7c8b312c-09bf-4c59-853f-1592391a9c57","savedPayload":{"position":{"x":24672.794812330034,"y":28740.255814175336},"targetPosition":{"x":24610.421305084707,"y":29033.700094395477},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"980ceb1d-7be6-454f-90d9-01ba1fd4a65d"}}}],"id":"8d58e84b-d7ef-464f-8079-0ec0887e3da3","savedPayload":{"position":{"x":24610.421305084707,"y":29033.700094395477},"targetPosition":{"x":24703.12640339719,"y":29319.017049284023},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"bf29e3bd-9386-408b-9091-042da0c53e81","savedPayload":{"position":{"x":24703.12640339719,"y":29319.017049284023},"targetPosition":{"x":24795.831501709672,"y":29604.334004172568},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Resistances and Supports","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"Resistances and Supports","config":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Resistances and Supports Multi-Period-Market","project":"Superalgos","id":"a707814e-b81b-4102-9b5b-4e2fe969324f","savedPayload":{"position":{"x":25052.525014680516,"y":28770.141229233177},"targetPosition":{"x":25068.2258015534,"y":29069.730089659548},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"5d9b2729-43fb-4eLine truncated
{"type":"Workspace","name":"Getting Started","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","dataMining":{"type":"Data Mining","name":"New Data Mining","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":"d244c564-4e86-43c7-9796-dc3b6294ec8b","savedPayload":{"position":{"x":23993.925629940142,"y":29195.742554406977},"targetPosition":{"x":24261.227587196652,"y":29331.93970432884},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Historic-OHLCVs","id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc"}}}],"id":"343313ae-5705-484d-8bf8-aed25ba61cfa","savedPayload":{"position":{"x":24261.227587196652,"y":29331.93970432884},"targetPosition":{"x":24528.529544453162,"y":29468.136854250704},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"a8f38508-1cac-4ab1-815f-d338fc813377","savedPayload":{"position":{"x":24528.529544453162,"y":29468.136854250704},"targetPosition":{"x":24795.831501709672,"y":29604.334004172568},"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":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Market","project":"Superalgos","id":"f0ef12ed-f0fd-4b88-8e15-27cf24265a5f","savedPayload":{"position":{"x":24387.47785744149,"y":28832.96091248782},"targetPosition":{"x":24610.421305084707,"y":29033.700094395477},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"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":"7c8b312c-09bf-4c59-853f-1592391a9c57","savedPayload":{"position":{"x":24672.794812330034,"y":28740.255814175336},"targetPosition":{"x":24610.421305084707,"y":29033.700094395477},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"980ceb1d-7be6-454f-90d9-01ba1fd4a65d"}}}],"id":"8d58e84b-d7ef-464f-8079-0ec0887e3da3","savedPayload":{"position":{"x":24610.421305084707,"y":29033.700094395477},"targetPosition":{"x":24703.12640339719,"y":29319.017049284023},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"bf29e3bd-9386-408b-9091-042da0c53e81","savedPayload":{"position":{"x":24703.12640339719,"y":29319.017049284023},"targetPosition":{"x":24795.831501709672,"y":29604.334004172568},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Resistances and Supports","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"Resistances and Supports","config":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"Resistances and Supports Multi-Period-Market","project":"Superalgos","id":"a707814e-b81b-4102-9b5b-4e2fe969324f","savedPayload":{"position":{"x":25052.525014680516,"y":28770.141229233177},"targetPosition":{"x":25068.2258015534,"y":29069.730089659548},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"5d9b2729-43fb-4eLine truncated
@@ -1 +1 @@
{"type":"Workspace","name":"Weak-hands Buster v2","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","dataMining":{"type":"Data Mining","name":"New Data Mining","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":"Sparta","project":"Superalgos","taskManagers":[{"type":"Task Manager","name":"Sparta","project":"Superalgos","tasks":[{"type":"Task","name":"EMA","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"EMA","config":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"EMA Multi-Period-Market","project":"Superalgos","id":"9adffd60-8756-44f0-9290-692711f43349","savedPayload":{"position":{"x":23796.023627541625,"y":29309.637679073698},"targetPosition":{"x":24089.467907761766,"y":29372.011186319025},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"278c34a7-199d-400e-8a06-087149e3d391"}}},{"type":"Indicator Process Instance","name":"EMA Multi-Period-Daily","project":"Superalgos","id":"559fc728-018a-4e8e-a5fa-1e37958e4f6c","savedPayload":{"position":{"x":23996.762809449283,"y":29086.69423143048},"targetPosition":{"x":24089.467907761766,"y":29372.011186319025},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"943ea24f-ee24-4eae-9b4b-e8a73122b1c2"}}}],"id":"82a8c05f-a6f6-4728-8271-7b327c2b72ee","savedPayload":{"position":{"x":24089.467907761766,"y":29372.011186319025},"targetPosition":{"x":24312.411355404984,"y":29572.750368226683},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"8ae4fc50-8c1f-4e45-9ffd-fad368816b9a","savedPayload":{"position":{"x":24312.411355404984,"y":29572.750368226683},"targetPosition":{"x":24535.3548030482,"y":29773.48955013434},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}}],"id":"51b49b9d-cb97-4d98-ad8f-9f691320bac2","savedPayload":{"position":{"x":24535.3548030482,"y":29773.48955013434},"targetPosition":{"x":24758.29825069142,"y":29974.228732042},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}}],"id":"63728769-73e4-474e-8aa3-0d82bedca08e","savedPayload":{"position":{"x":24758.29825069142,"y":29974.228732042},"targetPosition":{"x":24981.241698334637,"y":30174.96791394966},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Data Mine","name":"Sparta","id":"9cfffc48-486a-48cb-b641-98c82e314d3a"}}},{"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":"149bc037-9762-4737-b1b8-945b5ccee230","savedPayload":{"position":{"x":24503.771167102317,"y":28919.249010579722},"targetPosition":{"x":24704.510349009975,"y":29142.19245822294},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Historic-OHLCVs","id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc"}}}],"id":"507bc325-1cbd-40f4-85eb-cfe77b78000e","savedPayload":{"position":{"x":24704.510349009975,"y":29142.19245822294},"targetPosition":{"x":24905.249530917634,"y":29365.13590586616},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"7c28a4a4-86da-43be-9e89-d01b202f27eb","savedPayload":{"position":{"x":24905.249530917634,"y":29365.13590586616},"targetPosition":{"x":25105.988712825292,"y":29588.079353509376},"floatingObject":{"isPiLine truncated
{"type":"Workspace","name":"Weak-hands Buster v2","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","dataMining":{"type":"Data Mining","name":"New Data Mining","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":"Sparta","project":"Superalgos","taskManagers":[{"type":"Task Manager","name":"Sparta","project":"Superalgos","tasks":[{"type":"Task","name":"EMA","project":"Superalgos","bot":{"type":"Indicator Bot Instance","name":"EMA","config":"{}","project":"Superalgos","processes":[{"type":"Indicator Process Instance","name":"EMA Multi-Period-Market","project":"Superalgos","id":"9adffd60-8756-44f0-9290-692711f43349","savedPayload":{"position":{"x":23796.023627541625,"y":29309.637679073698},"targetPosition":{"x":24089.467907761766,"y":29372.011186319025},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"278c34a7-199d-400e-8a06-087149e3d391"}}},{"type":"Indicator Process Instance","name":"EMA Multi-Period-Daily","project":"Superalgos","id":"559fc728-018a-4e8e-a5fa-1e37958e4f6c","savedPayload":{"position":{"x":23996.762809449283,"y":29086.69423143048},"targetPosition":{"x":24089.467907761766,"y":29372.011186319025},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"943ea24f-ee24-4eae-9b4b-e8a73122b1c2"}}}],"id":"82a8c05f-a6f6-4728-8271-7b327c2b72ee","savedPayload":{"position":{"x":24089.467907761766,"y":29372.011186319025},"targetPosition":{"x":24312.411355404984,"y":29572.750368226683},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"8ae4fc50-8c1f-4e45-9ffd-fad368816b9a","savedPayload":{"position":{"x":24312.411355404984,"y":29572.750368226683},"targetPosition":{"x":24535.3548030482,"y":29773.48955013434},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}}],"id":"51b49b9d-cb97-4d98-ad8f-9f691320bac2","savedPayload":{"position":{"x":24535.3548030482,"y":29773.48955013434},"targetPosition":{"x":24758.29825069142,"y":29974.228732042},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}}],"id":"63728769-73e4-474e-8aa3-0d82bedca08e","savedPayload":{"position":{"x":24758.29825069142,"y":29974.228732042},"targetPosition":{"x":24981.241698334637,"y":30174.96791394966},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Data Mine","name":"Sparta","id":"9cfffc48-486a-48cb-b641-98c82e314d3a"}}},{"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":"149bc037-9762-4737-b1b8-945b5ccee230","savedPayload":{"position":{"x":24503.771167102317,"y":28919.249010579722},"targetPosition":{"x":24704.510349009975,"y":29142.19245822294},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Historic-OHLCVs","id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc"}}}],"id":"507bc325-1cbd-40f4-85eb-cfe77b78000e","savedPayload":{"position":{"x":24704.510349009975,"y":29142.19245822294},"targetPosition":{"x":24905.249530917634,"y":29365.13590586616},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"7c28a4a4-86da-43be-9e89-d01b202f27eb","savedPayload":{"position":{"x":24905.249530917634,"y":29365.13590586616},"targetPosition":{"x":25105.988712825292,"y":29588.079353509376},"floatingObject":{"isPiLine truncated
@@ -9344,7 +9344,7 @@
}
],
"initialValues": {
"config": "{ \n\"positionRate\": 0.1,\n\"stopLoss\": 0.2,\n\"takeProfit\": 0.3\n}"
"config": "{ \n\"marketOrderRate\": 0.1,\n\"stopLoss\": 0.2,\n\"takeProfit\": 0.3\n}"
},
"addLeftIcons": true,
"editors": {
@@ -1 +1 @@
[{"type":"Plotter Module","definition":"A plotter module is a device within a plotter that contains the definitions to create the visualization for a product definition.","content":["\r","\r","A single plotter may have several modules. Different modules may be used to plot each product of the bot, or as best suits the expected use-pattern.\r","\r","[![Plotter-Module-01](https://user-images.githubusercontent.com/13994516/71016077-eab41180-20f4-11ea-87e7-7262ff10a1ab.gif)](https://user-images.githubusercontent.com/13994516/71016077-eab41180-20f4-11ea-87e7-7262ff10a1ab.gif)\r","\r","{% include important.html content=\"For a bot to use a plotter, the corresponding product definition must establish a reference with the plotter module built to interpret the dataset.\" %}\r","\r","[![Plotter-Module-02-Product-Link](https://user-images.githubusercontent.com/13994516/71016079-eab41180-20f4-11ea-8afb-96321f9c68d8.gif)](https://user-images.githubusercontent.com/13994516/71016079-eab41180-20f4-11ea-8afb-96321f9c68d8.gif)\r","\r"],"folderName":"data_mine","adding":["\r","\r","To add a plotter module, select *Add Plotter Module* on the plotter node menu.\r","\r"],"configuring":["\r","\r","Select *Configure Plotter Module* on the menu to access the configuration.\r","\r","```json\r","{\r"," \"codeName\": \"Module Name\",\r"," \"isLegacy\": true,\r"," \"icon\": \"histogram\"\r","}\r","```\r","\r","* ```codeName``` is the name used in the code to refer to the module.\r","\r","* ```isLegacy``` is ```true``` for plotters modules developed entirely in JavaScript, and is ```false``` or doesn't show in the configuration for plotters built with the tools featured in the data mine hierarchy.\r","\r","* ```icon``` is the name of the image that illustrates the corresponding layer in the Layers Panel. In case the banner is not specified, the *default banner* is used. Current possible values are:\r","\r","\r","| Value | Image|\r","| :---: | :---: |\r","| ```default``` | ![Default-Banner](https://user-images.githubusercontent.com/13994516/70896073-5bbdd100-1ff0-11ea-84e3-5bd90475976f.png) |\r","| ```histogram``` | ![Histogram-Banner](https://user-images.githubusercontent.com/13994516/70896074-5bbdd100-1ff0-11ea-8dad-ccc6cfe64beb.png) |\r","| ```band``` | ![Bands-Banner](https://user-images.githubusercontent.com/13994516/70896072-5bbdd100-1ff0-11ea-8626-61c36bd22a3c.png) |\r","| ```moving-average``` | ![Moving-Average-Banner](https://user-images.githubusercontent.com/13994516/70896075-5bbdd100-1ff0-11ea-9909-dae33e57f65f.png) |\r","| ```oscillator``` | ![Oscillator-Banner](https://user-images.githubusercontent.com/13994516/70896076-5c566780-1ff0-11ea-8a5b-20077257c560.png) |\r","| ```trend``` | ![trends-banner](https://user-images.githubusercontent.com/13994516/70989177-744aeb80-20c3-11ea-88f5-d10473fa79b9.png) |\r","\r","Custom images may be added too. To do that:\r","\r","1. name the image in the following format: ```image-name.png```;\r","\r","1. place images in the ```WebServer\\Images\\Icons``` folder;\r","\r","1. in the configuration of the module, use the name as is (e.g.: ```\"icon\": \"image-name\"```)\r","\r"],"starting":["\r","\r","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r","\r"]},{"type":"Nodes Values"},{"type":"Nodes Highlights"},{"type":"Nodes Errors"},{"type":"Nodes Warnings"},{"type":"Nodes Infos"},{"type":"Nodes Status"},{"type":"Nodes Progress"},{"type":"Nodes Running"},{"type":"Nodes Announcements"},{"type":"Record Values"},{"type":"Shapes","definition":"The shapes node contains definitions of polygons and styles to be rendered on a per-period basis over the charts.","content":["\r","\r","A plotter recursively renders graphics for each period or candle. This means that a definition of what shapes need to be drawn for a single period is required. The plotter does the same thing for every period or candle that is visible on the screen at any point in time, for any time frame, as long as the corresponding data is available.\r","\r","[![Shapes-01-show-off](https://user-images.githubusercontent.com/13994516/71016080-eab41180-20f4-11ea-84c6-a514b87d568f.gif)](https://user-images.githubusercontent.com/13994516/71016080-eab41180-20f4-11ea-84c6-a514b87d568f.gif)\r","\r","In general terms, the process of defining what is going to be rendered on the screen consist of the following four steps:\r","\r"," 1. Identifying points defined by ```[x,y]``` coordinates\r"," 2. Defining polygons\r"," 3. Defining default styles\r"," 4. Defining conditional styles\r","\r"],"folderName":"data_mine","adding":["\r","\r","To add a shapes node, select *Add Shapes* on the plotter module menu.\r","\r"],"configuring":["\r","\r","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r","\r"],"starting":["\r","\r","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r","\r"]},{"type":"Plotter Panel","definition":"A plotter panel usually shows numerical representations of data over the charts on a small window or panel. Line truncated
[{"type":"Plotter Module","definition":"A plotter module is a device within a plotter that contains the definitions to create the visualization for a product definition.","content":["\r","\r","A single plotter may have several modules. Different modules may be used to plot each product of the bot, or as best suits the expected use-pattern.\r","\r","[![Plotter-Module-01](https://user-images.githubusercontent.com/13994516/71016077-eab41180-20f4-11ea-87e7-7262ff10a1ab.gif)](https://user-images.githubusercontent.com/13994516/71016077-eab41180-20f4-11ea-87e7-7262ff10a1ab.gif)\r","\r","{% include important.html content=\"For a bot to use a plotter, the corresponding product definition must establish a reference with the plotter module built to interpret the dataset.\" %}\r","\r","[![Plotter-Module-02-Product-Link](https://user-images.githubusercontent.com/13994516/71016079-eab41180-20f4-11ea-8afb-96321f9c68d8.gif)](https://user-images.githubusercontent.com/13994516/71016079-eab41180-20f4-11ea-8afb-96321f9c68d8.gif)\r","\r"],"folderName":"data_mine","adding":["\r","\r","To add a plotter module, select *Add Plotter Module* on the plotter node menu.\r","\r"],"configuring":["\r","\r","Select *Configure Plotter Module* on the menu to access the configuration.\r","\r","```json\r","{\r"," \"codeName\": \"Module Name\",\r"," \"isLegacy\": true,\r"," \"icon\": \"histogram\"\r","}\r","```\r","\r","* ```codeName``` is the name used in the code to refer to the module.\r","\r","* ```isLegacy``` is ```true``` for plotters modules developed entirely in JavaScript, and is ```false``` or doesn't show in the configuration for plotters built with the tools featured in the data mine hierarchy.\r","\r","* ```icon``` is the name of the image that illustrates the corresponding layer in the Layers Panel. In case the banner is not specified, the *default banner* is used. Current possible values are:\r","\r","\r","| Value | Image|\r","| :---: | :---: |\r","| ```default``` | ![Default-Banner](https://user-images.githubusercontent.com/13994516/70896073-5bbdd100-1ff0-11ea-84e3-5bd90475976f.png) |\r","| ```histogram``` | ![Histogram-Banner](https://user-images.githubusercontent.com/13994516/70896074-5bbdd100-1ff0-11ea-8dad-ccc6cfe64beb.png) |\r","| ```band``` | ![Bands-Banner](https://user-images.githubusercontent.com/13994516/70896072-5bbdd100-1ff0-11ea-8626-61c36bd22a3c.png) |\r","| ```moving-average``` | ![Moving-Average-Banner](https://user-images.githubusercontent.com/13994516/70896075-5bbdd100-1ff0-11ea-9909-dae33e57f65f.png) |\r","| ```oscillator``` | ![Oscillator-Banner](https://user-images.githubusercontent.com/13994516/70896076-5c566780-1ff0-11ea-8a5b-20077257c560.png) |\r","| ```trend``` | ![trends-banner](https://user-images.githubusercontent.com/13994516/70989177-744aeb80-20c3-11ea-88f5-d10473fa79b9.png) |\r","\r","Custom images may be added too. To do that:\r","\r","1. name the image in the following format: ```image-name.png```;\r","\r","1. place images in the ```WebServer\\Images\\Icons``` folder;\r","\r","1. in the configuration of the module, use the name as is (e.g.: ```\"icon\": \"image-name\"```)\r","\r"],"starting":["\r","\r","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r","\r"]},{"type":"Nodes Values"},{"type":"Nodes Highlights"},{"type":"Nodes Errors"},{"type":"Nodes Warnings"},{"type":"Nodes Infos"},{"type":"Nodes Status"},{"type":"Nodes Progress"},{"type":"Nodes Running"},{"type":"Nodes Announcements"},{"type":"Record Values"},{"type":"Shapes","definition":"The shapes node contains definitions of polygons and styles to be rendered on a per-period basis over the charts.","content":["\r","\r","A plotter recursively renders graphics for each period or candle. This means that a definition of what shapes need to be drawn for a single period is required. The plotter does the same thing for every period or candle that is visible on the screen at any point in time, for any time frame, as long as the corresponding data is available.\r","\r","[![Shapes-01-show-off](https://user-images.githubusercontent.com/13994516/71016080-eab41180-20f4-11ea-84c6-a514b87d568f.gif)](https://user-images.githubusercontent.com/13994516/71016080-eab41180-20f4-11ea-84c6-a514b87d568f.gif)\r","\r","In general terms, the process of defining what is going to be rendered on the screen consist of the following four steps:\r","\r"," 1. Identifying points defined by ```[x,y]``` coordinates\r"," 2. Defining polygons\r"," 3. Defining default styles\r"," 4. Defining conditional styles\r","\r"],"folderName":"data_mine","adding":["\r","\r","To add a shapes node, select *Add Shapes* on the plotter module menu.\r","\r"],"configuring":["\r","\r","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r","\r"],"starting":["\r","\r","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r","\r"]},{"type":"Plotter Panel","definition":"A plotter panel usually shows numerical representations of data over the charts on a small window or panel. Line truncated
@@ -15,6 +15,7 @@ function newPlottersManager() {
setDatetime: setDatetime,
setTimeFrame: setTimeFrame,
setCoordinateSystem: setCoordinateSystem,
physics: physics,
draw: draw,
getContainer: getContainer,
initialize: initialize,
@@ -486,4 +487,14 @@ function newPlottersManager() {
}
return maxElementsPlotted
}
function physics() {
if (thisObject.connectors === undefined) { return } // We need to wait
for (let i = 0; i < thisObject.connectors.length; i++) {
let connector = thisObject.connectors[thisObject.connectors.length - i - 1]
if (connector.plotter.physics !== undefined) {
connector.plotter.physics()
}
}
}
}
@@ -15,6 +15,7 @@ function newPlotter() {
setTimeFrame: setTimeFrame,
setDatetime: setDatetime,
setCoordinateSystem: setCoordinateSystem,
physics: physics,
draw: draw
}
@@ -244,11 +245,22 @@ function newPlotter() {
}
function draw() {
try {
thisObject.container.frame.draw()
plot()
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] draw -> err = ' + err.stack) }
thisObject.container.frame.draw()
plot()
}
function physics() {
for (let i = 0; i < records.length; i++) {
let record = records[i]
if (checkOutOfScreen(i, record) !== true) { continue }
if (productDefinition.referenceParent.shapes === undefined) { continue }
if (productDefinition.referenceParent.shapes.chartPoints === undefined) { continue }
dataPointsCalculation(record)
}
}
@@ -481,67 +493,10 @@ function newPlotter() {
for (let i = 0; i < records.length; i++) {
let record = records[i]
/*
In the formulas to create plotters, we allos users to reference the previous record.
To enable that we need to link all records to the previous one in this way.
*/
if (i == 0) {
record.previous = {} // this way it wont be undefined
} else {
record.previous = records[i - 1]
}
let beginPoint = {
x: record.begin,
y: 0
}
let endPoint = {
x: record.end,
y: 0
}
beginPoint = coordinateSystem.transformThisPoint(beginPoint)
endPoint = coordinateSystem.transformThisPoint(endPoint)
beginPoint = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(beginPoint, thisObject.container)
endPoint = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(endPoint, thisObject.container)
beginPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(beginPoint)
endPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(endPoint)
beginPoint = thisObject.fitFunction(beginPoint)
endPoint = thisObject.fitFunction(endPoint)
if (endPoint.x < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.x || beginPoint.x > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomRight.x) {
continue
}
if (checkOutOfScreen(i, record) !== true) { continue }
let atMousePosition = false
if (userPositionDate >= record.begin && userPositionDate <= record.end) {
if (productDefinition.referenceParent.config.useRateAtMousePosition === true) {
let ratePropertyName = "rate"
if (productDefinition.referenceParent.config.ratePropertyName !== undefined) {
ratePropertyName = productDefinition.referenceParent.config.ratePropertyName
}
if (record[ratePropertyName] === undefined) {
currentRecordChanged()
} else {
/* Current Record depends also on rate */
if (record[ratePropertyName] >= minUserPositionRate && record[ratePropertyName] <= maxUserPositionRate) {
currentRecordChanged()
}
}
} else {
/* Current Record depends only on begin and end. */
currentRecordChanged()
}
function currentRecordChanged() {
atMousePosition = true
thisObject.container.eventHandler.raiseEvent('Current Record Changed', record)
}
}
checkAtMousePosition()
/* If there is code we execute it now. */
if (productDefinition.referenceParent.javascriptCode !== undefined) {
@@ -550,158 +505,125 @@ function newPlotter() {
if (productDefinition.referenceParent.shapes === undefined) { continue }
if (productDefinition.referenceParent.shapes.chartPoints === undefined) { continue }
let dataPoints = new Map()
if (record.dataPoints !== undefined && mustRecalculateDataPoints === false) {
/* We use the datapoints already calculated. */
dataPoints = record.dataPoints
} else {
if (logged === false) {
logged = true
}
/* It seems we need to calculate the data points this time. */
for (let k = 0; k < productDefinition.referenceParent.shapes.chartPoints.length; k++) {
let chartPoints = productDefinition.referenceParent.shapes.chartPoints[k]
for (let j = 0; j < chartPoints.points.length; j++) {
let point = chartPoints.points[j]
if (point.pointFormula !== undefined) {
let x = 0
let y = 0
eval(point.pointFormula.code)
let rawPoint = {
x: x,
y: y
}
/*
The information we store in files is independent from the charing system and its coordinate systems.
That means that the first thing we allways need to do is to trasform these points to the coordinate system of the timeline.
*/
let dataPoint
dataPoint = coordinateSystem.transformThisPoint(rawPoint)
dataPoint = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(dataPoint, thisObject.container)
let testPoint = {
x: dataPoint.x,
y: dataPoint.y
}
dataPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
plotPolygons()
plotImages()
plotTexts()
if (testPoint.x === dataPoint.x) {
dataPoint.isInViewPort = true
} else {
dataPoint.isInViewPort = false
}
/* Store the data point at the local map */
dataPoint.rawPoint = rawPoint
dataPoints.set(point.id, dataPoint)
function checkAtMousePosition() {
if (userPositionDate >= record.begin && userPositionDate <= record.end) {
if (productDefinition.referenceParent.config.useRateAtMousePosition === true) {
let ratePropertyName = "rate"
if (productDefinition.referenceParent.config.ratePropertyName !== undefined) {
ratePropertyName = productDefinition.referenceParent.config.ratePropertyName
}
if (record[ratePropertyName] === undefined) {
currentRecordChanged()
} else {
/* Current Record depends also on rate */
if (record[ratePropertyName] >= minUserPositionRate && record[ratePropertyName] <= maxUserPositionRate) {
currentRecordChanged()
}
}
} else {
/* Current Record depends only on begin and end. */
currentRecordChanged()
}
function currentRecordChanged() {
atMousePosition = true
thisObject.container.eventHandler.raiseEvent('Current Record Changed', record)
}
}
/* Remember this datapoints, so that we do not need to calculate them again. */
record.dataPoints = dataPoints
}
/* Here we are going to plot all the polygons. */
for (let j = 0; j < productDefinition.referenceParent.shapes.polygons.length; j++) {
let polygon = productDefinition.referenceParent.shapes.polygons[j]
/* We will check if we need to plot this Polygon or not. */
if (polygon.polygonCondition !== undefined) {
let mustPlot = eval(polygon.polygonCondition.code)
if (mustPlot !== true) { continue }
}
let calculatedStyle
/* Finding out the fill style */
let fillStyle = { // default values
opacity: 1,
paletteColor: UI_COLOR.BLACK
}
if (polygon.polygonBody !== undefined) {
if (record.fillStyle === undefined) {
record.fillStyle = new Map()
function plotPolygons() {
/* Here we are going to plot all the polygons. */
for (let j = 0; j < productDefinition.referenceParent.shapes.polygons.length; j++) {
let polygon = productDefinition.referenceParent.shapes.polygons[j]
/* We will check if we need to plot this Polygon or not. */
if (polygon.polygonCondition !== undefined) {
let mustPlot = eval(polygon.polygonCondition.code)
if (mustPlot !== true) { continue }
}
calculatedStyle = record.fillStyle.get(polygon.id)
if (calculatedStyle !== undefined) {
/* We use the already calculated style */
fillStyle = calculatedStyle
} else {
/* Get the default style if exists */
if (polygon.polygonBody.style !== undefined) {
if (polygon.polygonBody.style.config !== undefined) {
if (polygon.polygonBody.style.config.default !== undefined) {
let bodyStyle = polygon.polygonBody.style.config.default
if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity }
if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) }
}
}
let calculatedStyle
/* Finding out the fill style */
let fillStyle = { // default values
opacity: 1,
paletteColor: UI_COLOR.BLACK
}
if (polygon.polygonBody !== undefined) {
if (record.fillStyle === undefined) {
record.fillStyle = new Map()
}
/* Apply conditional styles */
if (polygon.polygonBody.styleConditions !== undefined) {
for (let k = 0; k < polygon.polygonBody.styleConditions.length; k++) {
let condition = polygon.polygonBody.styleConditions[k]
let value = eval(condition.code)
if (value === true) {
if (condition.style !== undefined) {
let bodyStyle = condition.style.config
calculatedStyle = record.fillStyle.get(polygon.id)
if (calculatedStyle !== undefined) {
/* We use the already calculated style */
fillStyle = calculatedStyle
} else {
/* Get the default style if exists */
if (polygon.polygonBody.style !== undefined) {
if (polygon.polygonBody.style.config !== undefined) {
if (polygon.polygonBody.style.config.default !== undefined) {
let bodyStyle = polygon.polygonBody.style.config.default
if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity }
if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) }
}
}
}
}
/* Get the atMousePosition style if exists */
if (polygon.polygonBody.style !== undefined) {
if (polygon.polygonBody.style.config.atMousePosition !== undefined) {
let atMousePositionStyleDefinition = polygon.polygonBody.style.config.atMousePosition
let atMousePositionStyle = {}
if (atMousePositionStyleDefinition.opacity !== undefined) { atMousePositionStyle.opacity = atMousePositionStyleDefinition.opacity }
if (atMousePositionStyleDefinition.paletteColor !== undefined) { atMousePositionStyle.paletteColor = eval(atMousePositionStyleDefinition.paletteColor) }
atMousePositionFillStyles.set(polygon.id, atMousePositionStyle)
}
}
record.fillStyle.set(polygon.id, fillStyle)
}
}
/* Finding out the stroke style */
let strokeStyle = { // default values
opacity: 1,
paletteColor: UI_COLOR.BLACK,
lineWidth: 1,
lineDash: [0, 0]
}
if (polygon.polygonBorder !== undefined) {
if (record.strokeStyle === undefined) {
record.strokeStyle = new Map()
}
calculatedStyle = record.strokeStyle.get(polygon.id)
if (calculatedStyle !== undefined) {
/* We use the already calculated style */
strokeStyle = calculatedStyle
} else {
/* Get the default style if exists */
if (polygon.polygonBorder.style !== undefined) {
if (polygon.polygonBorder.style.config !== undefined) {
if (polygon.polygonBorder.style.config.default !== undefined) {
let borderStyle = polygon.polygonBorder.style.config.default
if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity }
if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) }
if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth }
if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash }
/* Apply conditional styles */
if (polygon.polygonBody.styleConditions !== undefined) {
for (let k = 0; k < polygon.polygonBody.styleConditions.length; k++) {
let condition = polygon.polygonBody.styleConditions[k]
let value = eval(condition.code)
if (value === true) {
if (condition.style !== undefined) {
let bodyStyle = condition.style.config
if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity }
if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) }
}
}
}
}
/* Get the atMousePosition style if exists */
if (polygon.polygonBody.style !== undefined) {
if (polygon.polygonBody.style.config.atMousePosition !== undefined) {
let atMousePositionStyleDefinition = polygon.polygonBody.style.config.atMousePosition
let atMousePositionStyle = {}
if (atMousePositionStyleDefinition.opacity !== undefined) { atMousePositionStyle.opacity = atMousePositionStyleDefinition.opacity }
if (atMousePositionStyleDefinition.paletteColor !== undefined) { atMousePositionStyle.paletteColor = eval(atMousePositionStyleDefinition.paletteColor) }
atMousePositionFillStyles.set(polygon.id, atMousePositionStyle)
}
}
record.fillStyle.set(polygon.id, fillStyle)
}
/* Apply conditional styles */
if (polygon.polygonBorder.styleConditions !== undefined) {
for (let k = 0; k < polygon.polygonBorder.styleConditions.length; k++) {
let condition = polygon.polygonBorder.styleConditions[k]
let value = eval(condition.code)
if (value === true) {
if (condition.style !== undefined) {
let borderStyle = condition.style.config
}
/* Finding out the stroke style */
let strokeStyle = { // default values
opacity: 1,
paletteColor: UI_COLOR.BLACK,
lineWidth: 1,
lineDash: [0, 0]
}
if (polygon.polygonBorder !== undefined) {
if (record.strokeStyle === undefined) {
record.strokeStyle = new Map()
}
calculatedStyle = record.strokeStyle.get(polygon.id)
if (calculatedStyle !== undefined) {
/* We use the already calculated style */
strokeStyle = calculatedStyle
} else {
/* Get the default style if exists */
if (polygon.polygonBorder.style !== undefined) {
if (polygon.polygonBorder.style.config !== undefined) {
if (polygon.polygonBorder.style.config.default !== undefined) {
let borderStyle = polygon.polygonBorder.style.config.default
if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity }
if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) }
if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth }
@@ -709,185 +631,287 @@ function newPlotter() {
}
}
}
/* Apply conditional styles */
if (polygon.polygonBorder.styleConditions !== undefined) {
for (let k = 0; k < polygon.polygonBorder.styleConditions.length; k++) {
let condition = polygon.polygonBorder.styleConditions[k]
let value = eval(condition.code)
if (value === true) {
if (condition.style !== undefined) {
let borderStyle = condition.style.config
if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity }
if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) }
if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth }
if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash }
}
}
}
}
/* Get the atMousePosition style if exists */
if (polygon.polygonBorder.style !== undefined) {
if (polygon.polygonBorder.style.config.atMousePosition !== undefined) {
let atMousePositionStyleDefinition = polygon.polygonBorder.style.config.atMousePosition
let atMousePositionStyle = {}
if (atMousePositionStyleDefinition.opacity !== undefined) { atMousePositionStyle.opacity = atMousePositionStyleDefinition.opacity }
if (atMousePositionStyleDefinition.paletteColor !== undefined) { atMousePositionStyle.paletteColor = eval(atMousePositionStyleDefinition.paletteColor) }
if (atMousePositionStyleDefinition.lineWidth !== undefined) { atMousePositionStyle.lineWidth = atMousePositionStyleDefinition.lineWidth }
if (atMousePositionStyleDefinition.lineDash !== undefined) { atMousePositionStyle.lineDash = atMousePositionStyleDefinition.lineDash }
atMousePositionStrokeStyles.set(polygon.id, atMousePositionStyle)
}
}
record.strokeStyle.set(polygon.id, strokeStyle)
}
/* Get the atMousePosition style if exists */
if (polygon.polygonBorder.style !== undefined) {
if (polygon.polygonBorder.style.config.atMousePosition !== undefined) {
let atMousePositionStyleDefinition = polygon.polygonBorder.style.config.atMousePosition
let atMousePositionStyle = {}
if (atMousePositionStyleDefinition.opacity !== undefined) { atMousePositionStyle.opacity = atMousePositionStyleDefinition.opacity }
if (atMousePositionStyleDefinition.paletteColor !== undefined) { atMousePositionStyle.paletteColor = eval(atMousePositionStyleDefinition.paletteColor) }
if (atMousePositionStyleDefinition.lineWidth !== undefined) { atMousePositionStyle.lineWidth = atMousePositionStyleDefinition.lineWidth }
if (atMousePositionStyleDefinition.lineDash !== undefined) { atMousePositionStyle.lineDash = atMousePositionStyleDefinition.lineDash }
atMousePositionStrokeStyles.set(polygon.id, atMousePositionStyle)
}
/* Draw the Polygon */
browserCanvasContext.beginPath()
for (let k = 0; k < polygon.polygonVertexes.length; k++) {
let polygonVertex = polygon.polygonVertexes[k]
if (polygonVertex.referenceParent !== undefined) {
let dataPointObject = record.dataPoints.get(polygonVertex.referenceParent.id)
if (dataPointObject === undefined) {
polygonVertex.payload.uiObject.setErrorMessage('Vertex not referencing any Point')
console.log('[WARN] You have a Polygon Vertex not referencing any Point.')
continue
}
let dataPoint = {
x: dataPointObject.x,
y: dataPointObject.y
}
/* We make sure the points do not fall outside the viewport visible area. This step allways need to be done. */
dataPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
if (k === 0) {
browserCanvasContext.moveTo(dataPoint.x, dataPoint.y)
} else {
browserCanvasContext.lineTo(dataPoint.x, dataPoint.y)
}
}
}
browserCanvasContext.closePath()
/* Apply the fill style to the canvas object */
if (polygon.polygonBody !== undefined) {
/* Replace the fill style if we are at mouse position */
if (atMousePosition === true) {
let atMousePositionFillStyle = atMousePositionFillStyles.get(polygon.id)
if (atMousePositionFillStyle !== undefined) {
fillStyle = atMousePositionFillStyle
}
}
record.strokeStyle.set(polygon.id, strokeStyle)
browserCanvasContext.fillStyle = 'rgba(' + fillStyle.paletteColor + ', ' + fillStyle.opacity + ')'
browserCanvasContext.fill()
}
/* Apply the stroke style to the canvas object */
if (polygon.polygonBorder !== undefined) {
/* Replace the stroke style if we are at mouse position */
if (atMousePosition === true) {
let atMousePositionStrokeStyle = atMousePositionStrokeStyles.get(polygon.id)
if (atMousePositionStrokeStyle !== undefined) {
strokeStyle = atMousePositionStrokeStyle
}
}
browserCanvasContext.lineWidth = strokeStyle.lineWidth
browserCanvasContext.setLineDash(strokeStyle.lineDash)
browserCanvasContext.strokeStyle = 'rgba(' + strokeStyle.paletteColor + ', ' + strokeStyle.opacity + ')'
browserCanvasContext.stroke()
}
}
}
/* Draw the Polygon */
browserCanvasContext.beginPath()
for (let k = 0; k < polygon.polygonVertexes.length; k++) {
let polygonVertex = polygon.polygonVertexes[k]
if (polygonVertex.referenceParent !== undefined) {
let dataPointObject = dataPoints.get(polygonVertex.referenceParent.id)
if (dataPointObject === undefined) {
polygonVertex.payload.uiObject.setErrorMessage('Vertex not referencing any Point')
console.log('[WARN] You have a Polygon Vertex not referencing any Point.')
continue
}
function plotImages() {
/* Here we are going to plot images. */
for (let j = 0; j < productDefinition.referenceParent.shapes.images.length; j++) {
let image = productDefinition.referenceParent.shapes.images[j]
if (image.imagePosition === undefined) { continue }
if (image.imagePosition.referenceParent === undefined) { continue }
if (image.imageCondition !== undefined) {
let mustPlot = eval(image.imageCondition.code)
if (mustPlot !== true) { continue }
}
let imageName = ''
let imageSize = 0
let offsetX = 0
let offsetY = 0
let imagePosition = { x: 0, y: 0 }
if (image.config.codeName !== undefined) { imageName = image.config.codeName }
if (image.config.size !== undefined) { imageSize = image.config.size }
if (image.imagePosition.config.offsetX !== undefined) { offsetX = image.imagePosition.config.offsetX }
if (image.imagePosition.config.offsetY !== undefined) { offsetY = image.imagePosition.config.offsetY }
let dataPointObject = record.dataPoints.get(image.imagePosition.referenceParent.id)
if (dataPointObject === undefined) { continue }
let dataPoint = {
x: dataPointObject.x,
y: dataPointObject.y
}
dataPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
let dataPoint = {
x: dataPointObject.x,
y: dataPointObject.y
imagePosition.x = dataPoint.x
imagePosition.y = dataPoint.y
let imageToDraw = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName('Superalgos', imageName)
if (imageToDraw !== undefined) {
if (imageToDraw.canDrawIcon === true) {
browserCanvasContext.drawImage(imageToDraw, imagePosition.x - imageSize / 2 + offsetX, imagePosition.y - imageSize / 2 - offsetY, imageSize, imageSize)
}
/* We make sure the points do not fall outside the viewport visible area. This step allways need to be done. */
dataPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
} else {
console.log('Can not plot image named ' + imageName + ' of product ' + productDefinition.name + ' because it does not exist.')
}
}
}
function plotTexts() {
/* Here we are going to plot texts. */
for (let j = 0; j < productDefinition.referenceParent.shapes.texts.length; j++) {
let text = productDefinition.referenceParent.shapes.texts[j]
if (text.textPosition === undefined) { continue }
if (text.textPosition.referenceParent === undefined) { continue }
if (text.textCondition !== undefined) {
let mustPlot = eval(text.textCondition.code)
if (mustPlot !== true) { continue }
}
if (text.textFormula === undefined) { continue }
if (text.textStyle === undefined) { continue }
let value = eval(text.textFormula.code)
let fontSize = 0
let opacity = 0
let paletteColor = UI_COLOR.GREY
let offsetX = 0
let offsetY = 0
let textPosition = { x: 0, y: 0 }
if (text.textStyle.config.fontSize !== undefined) { fontSize = text.textStyle.config.fontSize }
if (text.textStyle.config.opacity !== undefined) { opacity = text.textStyle.config.opacity }
if (text.textStyle.config.paletteColor !== undefined) { paletteColor = eval(text.textStyle.config.paletteColor) }
if (text.textPosition.config.offsetX !== undefined) { offsetX = text.textPosition.config.offsetX }
if (text.textPosition.config.offsetY !== undefined) { offsetY = text.textPosition.config.offsetY }
let dataPointObject = record.dataPoints.get(text.textPosition.referenceParent.id)
if (dataPointObject === undefined) { continue }
let dataPoint = {
x: dataPointObject.x,
y: dataPointObject.y
}
dataPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
textPosition.x = dataPoint.x
textPosition.y = dataPoint.y
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(' + paletteColor + ', ' + opacity + ')'
browserCanvasContext.fillText(value, textPosition.x + offsetX, textPosition.y - offsetY)
}
}
}
logged = false
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] plot -> err = ' + err.stack) }
}
}
function checkOutOfScreen(i, record) {
/*
In the formulas to create plotters, we allos users to reference the previous record.
To enable that we need to link all records to the previous one in this way.
*/
if (i == 0) {
record.previous = {} // this way it wont be undefined
} else {
record.previous = records[i - 1]
}
let beginPoint = {
x: record.begin,
y: 0
}
let endPoint = {
x: record.end,
y: 0
}
beginPoint = coordinateSystem.transformThisPoint(beginPoint)
endPoint = coordinateSystem.transformThisPoint(endPoint)
beginPoint = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(beginPoint, thisObject.container)
endPoint = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(endPoint, thisObject.container)
beginPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(beginPoint)
endPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(endPoint)
beginPoint = thisObject.fitFunction(beginPoint)
endPoint = thisObject.fitFunction(endPoint)
if (endPoint.x < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.x || beginPoint.x > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomRight.x) {
return false
} else {
return true
}
}
function dataPointsCalculation(record) {
if (record.dataPoints !== undefined && mustRecalculateDataPoints === false) {
/* We use the datapoints already calculated. */
dataPoints = record.dataPoints
} else {
if (logged === false) {
logged = true
}
let dataPoints = new Map()
/* It seems we need to calculate the data points this time. */
for (let k = 0; k < productDefinition.referenceParent.shapes.chartPoints.length; k++) {
let chartPoints = productDefinition.referenceParent.shapes.chartPoints[k]
for (let j = 0; j < chartPoints.points.length; j++) {
let point = chartPoints.points[j]
if (point.pointFormula !== undefined) {
let x = 0
let y = 0
eval(point.pointFormula.code)
let rawPoint = {
x: x,
y: y
}
/*
The information we store in files is independent from the charing system and its coordinate systems.
That means that the first thing we allways need to do is to trasform these points to the coordinate system of the timeline.
*/
let dataPoint
dataPoint = coordinateSystem.transformThisPoint(rawPoint)
dataPoint = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(dataPoint, thisObject.container)
let testPoint = {
x: dataPoint.x,
y: dataPoint.y
}
dataPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
if (testPoint.x === dataPoint.x) {
/*
Contributing to Auto-Scale: A point will contribute to the y coordinate only if the x coordinate is plotted in the screen.
It can happen that objects that span through a long period of time could have its begin point inside the visible
viewport but not its end point. In those cases, the end point should not be reported.
*/
if (dataPointObject.rawPoint.y > 1 && dataPointObject.rawPoint.y !== undefined && isNaN(dataPointObject.rawPoint.y) === false) {
let rawPoint = coordinateSystem.transformThisPoint(dataPointObject.rawPoint)
if (dataPointObject.isInViewPort === true) {
coordinateSystem.reportYValue(dataPointObject.rawPoint.y)
}
}
if (k === 0) {
browserCanvasContext.moveTo(dataPoint.x, dataPoint.y)
} else {
browserCanvasContext.lineTo(dataPoint.x, dataPoint.y)
if (rawPoint.y > 0 && rawPoint.y !== undefined && isNaN(rawPoint.y) === false) {
coordinateSystem.reportYValue(rawPoint.y)
}
}
/* Store the data point at the local map */
dataPoint.rawPoint = rawPoint
dataPoints.set(point.id, dataPoint)
}
browserCanvasContext.closePath()
/* Apply the fill style to the canvas object */
if (polygon.polygonBody !== undefined) {
/* Replace the fill style if we are at mouse position */
if (atMousePosition === true) {
let atMousePositionFillStyle = atMousePositionFillStyles.get(polygon.id)
if (atMousePositionFillStyle !== undefined) {
fillStyle = atMousePositionFillStyle
}
}
browserCanvasContext.fillStyle = 'rgba(' + fillStyle.paletteColor + ', ' + fillStyle.opacity + ')'
browserCanvasContext.fill()
}
/* Apply the stroke style to the canvas object */
if (polygon.polygonBorder !== undefined) {
/* Replace the stroke style if we are at mouse position */
if (atMousePosition === true) {
let atMousePositionStrokeStyle = atMousePositionStrokeStyles.get(polygon.id)
if (atMousePositionStrokeStyle !== undefined) {
strokeStyle = atMousePositionStrokeStyle
}
}
browserCanvasContext.lineWidth = strokeStyle.lineWidth
browserCanvasContext.setLineDash(strokeStyle.lineDash)
browserCanvasContext.strokeStyle = 'rgba(' + strokeStyle.paletteColor + ', ' + strokeStyle.opacity + ')'
browserCanvasContext.stroke()
}
}
/* Here we are going to plot images. */
for (let j = 0; j < productDefinition.referenceParent.shapes.images.length; j++) {
let image = productDefinition.referenceParent.shapes.images[j]
if (image.imagePosition === undefined) { continue }
if (image.imagePosition.referenceParent === undefined) { continue }
if (image.imageCondition !== undefined) {
let mustPlot = eval(image.imageCondition.code)
if (mustPlot !== true) { continue }
}
let imageName = ''
let imageSize = 0
let offsetX = 0
let offsetY = 0
let imagePosition = { x: 0, y: 0 }
if (image.config.codeName !== undefined) { imageName = image.config.codeName }
if (image.config.size !== undefined) { imageSize = image.config.size }
if (image.imagePosition.config.offsetX !== undefined) { offsetX = image.imagePosition.config.offsetX }
if (image.imagePosition.config.offsetY !== undefined) { offsetY = image.imagePosition.config.offsetY }
let dataPointObject = dataPoints.get(image.imagePosition.referenceParent.id)
if (dataPointObject === undefined) { continue }
let dataPoint = {
x: dataPointObject.x,
y: dataPointObject.y
}
dataPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
imagePosition.x = dataPoint.x
imagePosition.y = dataPoint.y
let imageToDraw = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName('Superalgos', imageName)
if (imageToDraw !== undefined) {
if (imageToDraw.canDrawIcon === true) {
browserCanvasContext.drawImage(imageToDraw, imagePosition.x - imageSize / 2 + offsetX, imagePosition.y - imageSize / 2 - offsetY, imageSize, imageSize)
}
} else {
console.log('Can not plot image named ' + imageName + ' of product ' + productDefinition.name + ' because it does not exist.')
}
}
/* Here we are going to plot texts. */
for (let j = 0; j < productDefinition.referenceParent.shapes.texts.length; j++) {
let text = productDefinition.referenceParent.shapes.texts[j]
if (text.textPosition === undefined) { continue }
if (text.textPosition.referenceParent === undefined) { continue }
if (text.textCondition !== undefined) {
let mustPlot = eval(text.textCondition.code)
if (mustPlot !== true) { continue }
}
if (text.textFormula === undefined) { continue }
if (text.textStyle === undefined) { continue }
let value = eval(text.textFormula.code)
let fontSize = 0
let opacity = 0
let paletteColor = UI_COLOR.GREY
let offsetX = 0
let offsetY = 0
let textPosition = { x: 0, y: 0 }
if (text.textStyle.config.fontSize !== undefined) { fontSize = text.textStyle.config.fontSize }
if (text.textStyle.config.opacity !== undefined) { opacity = text.textStyle.config.opacity }
if (text.textStyle.config.paletteColor !== undefined) { paletteColor = eval(text.textStyle.config.paletteColor) }
if (text.textPosition.config.offsetX !== undefined) { offsetX = text.textPosition.config.offsetX }
if (text.textPosition.config.offsetY !== undefined) { offsetY = text.textPosition.config.offsetY }
let dataPointObject = dataPoints.get(text.textPosition.referenceParent.id)
if (dataPointObject === undefined) { continue }
let dataPoint = {
x: dataPointObject.x,
y: dataPointObject.y
}
dataPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
textPosition.x = dataPoint.x
textPosition.y = dataPoint.y
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(' + paletteColor + ', ' + opacity + ')'
browserCanvasContext.fillText(value, textPosition.x + offsetX, textPosition.y - offsetY)
}
}
if (coordinateSystem.autoMinYScale === true || coordinateSystem.autoMaxYScale === true) {
mustRecalculateDataPoints = true
} else {
mustRecalculateDataPoints = false
}
logged = false
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] plot -> err = ' + err.stack) }
/* Remember this datapoints, so that we do not need to calculate them again. */
record.dataPoints = dataPoints
}
}
@@ -167,7 +167,7 @@ function newTimelineChart() {
minValue,
maxValue,
thisObject.container.frame.width,
thisObject.container.frame.heigh
thisObject.container.frame.heigh
)
}
@@ -311,12 +311,19 @@ function newTimelineChart() {
}
function physics() {
plotterManagerPhysics()
thisObjectPhysics()
childrenPhysics()
syncWithDesignerScales()
syncWithDesignerLayerManager()
}
function plotterManagerPhysics() {
if (thisObject.plotterManager !== undefined) {
thisObject.plotterManager.physics()
}
}
function thisObjectPhysics() {
/* Only if the plotter manager has some layer turned on, we will pass the min and max upstream. */
if (thisObject.plotterManager !== undefined && thisObject.plotterManager.connectors.length > 0) {
@@ -92,7 +92,7 @@ function newSuperalgosUtilitiesNodeChildren() {
switch (property.type) {
case 'node': {
let child = startingNode[property.name]
if (child === undefined) { continue }
if (child.payload !== undefined) {
if (child.payload.referenceParent !== undefined) {
if (child.payload.referenceParent.id === checkNode.id) {
@@ -121,7 +121,6 @@ function newSuperalgosUtilitiesNodeChildren() {
}
}
}
return true
}
}
@@ -63,7 +63,7 @@ exports.newOrdersCalculations = function newOrdersCalculations(bot, logger) {
function recalculateActualSize() {
/*
We will recalculate the Quoted Asset Actual Size. This will also give to it an initial value the first time we do this.
We will recalculate the Quoted Asset Actual Size. This will also give to it an initial value.
In the next formula, we are unsing the rate of the order because we dont know yet the Actual Rate.
This rate might be replaced afteerwards for the Actual Rate when this is calculated again once
the Actual Rate is known.
@@ -279,7 +279,7 @@ exports.newOrdersCalculations = function newOrdersCalculations(bot, logger) {
need to calculate that by ourselves.
*/
tradingEngineOrder.orderQuotedAsset.sizeFilled.value =
tradingEngineOrder.orderQuotedAsset.sizeFilled.value * tradingEngineOrder.orderStatistics.percentageFilled.value / 100
tradingEngineOrder.orderQuotedAsset.actualSize.value * tradingEngineOrder.orderStatistics.percentageFilled.value / 100
tradingEngineOrder.orderQuotedAsset.sizeFilled.value = global.PRECISE(tradingEngineOrder.orderQuotedAsset.sizeFilled.value, 10)
}
@@ -297,7 +297,7 @@ exports.newOrdersCalculations = function newOrdersCalculations(bot, logger) {
/*
In this case the Amount Received is in Base Asset.
*/
tradingEngineOrder.orderBaseAsset.amountReceived.value.value =
tradingEngineOrder.orderBaseAsset.amountReceived.value =
tradingEngineOrder.orderBaseAsset.sizeFilled.value -
tradingEngineOrder.orderBaseAsset.feesPaid.value
break
@@ -306,7 +306,7 @@ exports.newOrdersCalculations = function newOrdersCalculations(bot, logger) {
/*
In this case the Amount Received is in Quoted Asset.
*/
tradingEngineOrder.orderQuotedAsset.amountReceived.value.value =
tradingEngineOrder.orderQuotedAsset.amountReceived.value =
tradingEngineOrder.orderQuotedAsset.sizeFilled.value -
tradingEngineOrder.orderQuotedAsset.feesPaid.value
break
@@ -83,7 +83,7 @@ exports.newOrdersSimulations = function newOrdersSimulations(bot, logger) {
case 'Market Order': {
/* Actual Rate is simulated based on the Session Paremeters */
let slippageAmount = tradingEngineOrder.rate.value * sessionParameters.slippage.config.positionRate / 100
let slippageAmount = tradingEngineOrder.rate.value * sessionParameters.slippage.config.marketOrderRate / 100
if (slippageAmount !== 0) {
switch (tradingSystemOrder.type) {
case 'Market Sell Order': {
@@ -93,7 +93,7 @@ exports.newOrdersSimulations = function newOrdersSimulations(bot, logger) {
tradingSystem.warnings.push(
[
[sessionParameters.slippage.id, tradingEngineOrder.rate.id, tradingEngineOrder.orderStatistics.actualRate.id],
'slippage.config.positionRate Slippage Amount (' + slippageAmount + ') substracted from Order Rate (' + tradingEngineOrder.rate.value + ') to get the Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ')'
'slippage.config.marketOrderRate Slippage Amount (' + slippageAmount + ') substracted from Order Rate (' + tradingEngineOrder.rate.value + ') to get the Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ')'
]
)
break
@@ -105,7 +105,7 @@ exports.newOrdersSimulations = function newOrdersSimulations(bot, logger) {
tradingSystem.warnings.push(
[
[sessionParameters.slippage.id, tradingEngineOrder.rate.id, tradingEngineOrder.orderStatistics.actualRate.id],
'slippage.config.positionRate Slippage Amount (' + slippageAmount + ') added to Order Rate (' + tradingEngineOrder.rate.value + ') to get the Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ')'
'slippage.config.marketOrderRate Slippage Amount (' + slippageAmount + ') added to Order Rate (' + tradingEngineOrder.rate.value + ') to get the Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ')'
]
)
break
@@ -414,7 +414,7 @@ exports.newOrdersSimulations = function newOrdersSimulations(bot, logger) {
/*
In this case the Amount Received is in Base Asset.
*/
tradingEngineOrder.orderBaseAsset.amountReceived.value.value =
tradingEngineOrder.orderBaseAsset.amountReceived.value =
tradingEngineOrder.orderBaseAsset.sizeFilled.value -
tradingEngineOrder.orderBaseAsset.feesPaid.value
break
@@ -423,7 +423,7 @@ exports.newOrdersSimulations = function newOrdersSimulations(bot, logger) {
/*
In this case the Amount Received is in Quoted Asset.
*/
tradingEngineOrder.orderQuotedAsset.amountReceived.value.value =
tradingEngineOrder.orderQuotedAsset.amountReceived.value =
tradingEngineOrder.orderQuotedAsset.sizeFilled.value -
tradingEngineOrder.orderQuotedAsset.feesPaid.value
break
@@ -17,7 +17,7 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
let tradingSystem
let tradingEngine
let sessionParameters
let dynamicIndicators
let dynamicIndicators
const TRADING_STAGES_MODULE = require('./TradingStages.js')
let tradingStagesModule = TRADING_STAGES_MODULE.newTradingStages(bot, logger, tradingEngineModule)
@@ -131,8 +131,8 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
for (let i = 0; i < tradingSystem.dynamicIndicators.indicatorFunctions.length; i++) {
let indicatorFunction = tradingSystem.dynamicIndicators.indicatorFunctions[i]
if (indicatorFunction.formula === undefined) { return}
if (indicatorFunction.config.codeName === undefined) { return}
if (indicatorFunction.formula === undefined) { return }
if (indicatorFunction.config.codeName === undefined) { return }
dynamicIndicators[indicatorFunction.config.codeName] = tradingSystem.formulas.get(indicatorFunction.formula.id)
}
}
@@ -257,15 +257,7 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
will not be considered an error.
*/
value = false
if (code.indexOf('previous') > -1 && err.message.indexOf('of undefined') > -1
) {
/*
We are not going to set an error for the casess we are using previous and the error is that the indicator is undefined.
*/
} else {
error = err.message
}
error = err.message
}
tradingSystem.conditions.set(node.id, value)
@@ -297,15 +289,7 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
will not be considered an error.
*/
value = 0
if (node.code.indexOf('previous') > -1 && err.message.indexOf('of undefined') > -1
) {
/*
We are not going to set an error for the casess we are using previous and the error is that the indicator is undefined.
*/
} else {
error = err.message
}
error = err.message
}
if (error !== undefined) {
+3 -3
View File
@@ -326,14 +326,14 @@
name: 'Missing Slippage',
type: 'Slippage',
config: {
positionRate: 0,
marketOrderRate: 0,
stopLoss: 0,
takeProfit: 0
}
}
}
if (bot.SESSION.parameters.slippage.config.positionRate === undefined) { // if the positionRate is missing we create a default one.
bot.SESSION.parameters.slippage.config.positionRate = 0
if (bot.SESSION.parameters.slippage.config.marketOrderRate === undefined) { // if the marketOrderRate is missing we create a default one.
bot.SESSION.parameters.slippage.config.marketOrderRate = 0
}
if (bot.SESSION.parameters.slippage.config.stopLoss === undefined) { // if the stopLoss is missing we create a default one.
bot.SESSION.parameters.slippage.config.stopLoss = 0