Merge pull request #498 from Luis-Fernando-Molina/develop

Contribution: Warning Handling Improved at the LF Trading Engine
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-01-29 10:11:39 +01:00
commit 6b8044ea24
23 files changed
+1240 -61

No files matched your search

@@ -1 +1 @@
{"type":"Trading Mine","name":"Masters","config":"{ \n\"codeName\": \"Masters\"\n}","project":"Superalgos","tradingBots":[{"type":"Trading Bot","name":"Low Frequency","config":"{\n\"codeName\": \"Low-Frequency\"\n}","project":"Superalgos","processes":[{"type":"Process Definition","name":"Trading","config":"{\n \"codeName\": \"Trading\",\n \"sessionRunWaitTime\": 5000,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Low-Frequency-Trading-Process\"\n }\n }","project":"Superalgos","processOutput":{"type":"Process Output","name":"New Process Output","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Trading Engine","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Episode","project":"Superalgos","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Episode Counters","project":"Superalgos","id":"ec8d74ba-a4ad-417a-b479-6bae95b8a1fe","savedPayload":{"position":{"x":24910.97457254189,"y":18457.46644293786},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"3ed03a02-381d-43fe-9faa-761728c53bd8"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Counters","project":"Superalgos","id":"22b0af33-8c2f-4194-839b-affd18f298d5","savedPayload":{"position":{"x":24834.601232363748,"y":18490.07023931273},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"15f5b150-f1cf-403c-8cb9-2c7c4e1db8e8"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Statistics","project":"Superalgos","id":"23ab91ae-2e78-4993-bb69-855f69cef1ce","savedPayload":{"position":{"x":24753.53736157276,"y":18508.085329665024},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"fc9dc0f7-35e0-4548-bb91-f920825d694f"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Statistics","project":"Superalgos","id":"d0a4515a-279d-4c27-8de2-168108861242","savedPayload":{"position":{"x":24670.543493063306,"y":18510.89823169951},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"91953362-8751-4440-a898-21245cd47c15"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Candle","project":"Superalgos","id":"7fc80977-5b37-413e-8107-0a89a16e08b0","savedPayload":{"position":{"x":24588.445883487308,"y":18498.413155411115},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"17fb41f5-61b5-4433-9a10-950ff8216a7e"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Candle","project":"Superalgos","id":"a6888750-1043-420c-9253-633e1399c5e4","savedPayload":{"position":{"x":24510.040268473647,"y":18471.05526509864},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"bbc9467d-28bf-432b-9e49-582d1bcabfb9"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Balances","project":"Superalgos","id":"0ad114df-f076-4a86-8c62-4c4a146da73c","savedPayload":{"position":{"x":24437.996657204443,"y":18429.756200904503},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"acddff59-b51b-4b45-b58f-71d4077755ee"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Balances","project":"Superalgos","id":"04b51302-957d-4365-ad55-9f89d60e261c","savedPayload":{"position":{"x":24374.76840845468,"y":18375.922352927064},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFroLine truncated
{"type":"Trading Mine","name":"Masters","config":"{ \n\"codeName\": \"Masters\"\n}","project":"Superalgos","tradingBots":[{"type":"Trading Bot","name":"Low Frequency","config":"{\n\"codeName\": \"Low-Frequency\"\n}","project":"Superalgos","processes":[{"type":"Process Definition","name":"Trading","config":"{\n \"codeName\": \"Trading\",\n \"sessionRunWaitTime\": 5000,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Low-Frequency-Trading-Process\"\n }\n }","project":"Superalgos","processOutput":{"type":"Process Output","name":"New Process Output","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Trading Engine","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Episode","project":"Superalgos","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Episode Counters","project":"Superalgos","id":"ec8d74ba-a4ad-417a-b479-6bae95b8a1fe","savedPayload":{"position":{"x":24910.97457254189,"y":18457.46644293786},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"3ed03a02-381d-43fe-9faa-761728c53bd8"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Counters","project":"Superalgos","id":"22b0af33-8c2f-4194-839b-affd18f298d5","savedPayload":{"position":{"x":24834.601232363748,"y":18490.07023931273},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"15f5b150-f1cf-403c-8cb9-2c7c4e1db8e8"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Statistics","project":"Superalgos","id":"23ab91ae-2e78-4993-bb69-855f69cef1ce","savedPayload":{"position":{"x":24753.53736157276,"y":18508.085329665024},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"fc9dc0f7-35e0-4548-bb91-f920825d694f"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Statistics","project":"Superalgos","id":"d0a4515a-279d-4c27-8de2-168108861242","savedPayload":{"position":{"x":24670.543493063306,"y":18510.89823169951},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"91953362-8751-4440-a898-21245cd47c15"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Candle","project":"Superalgos","id":"7fc80977-5b37-413e-8107-0a89a16e08b0","savedPayload":{"position":{"x":24588.445883487308,"y":18498.413155411115},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"17fb41f5-61b5-4433-9a10-950ff8216a7e"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Candle","project":"Superalgos","id":"a6888750-1043-420c-9253-633e1399c5e4","savedPayload":{"position":{"x":24510.040268473647,"y":18471.05526509864},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"bbc9467d-28bf-432b-9e49-582d1bcabfb9"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Balances","project":"Superalgos","id":"0ad114df-f076-4a86-8c62-4c4a146da73c","savedPayload":{"position":{"x":24437.996657204443,"y":18429.756200904503},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"acddff59-b51b-4b45-b58f-71d4077755ee"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Balances","project":"Superalgos","id":"04b51302-957d-4365-ad55-9f89d60e261c","savedPayload":{"position":{"x":24374.76840845468,"y":18375.922352927064},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFroLine truncated
@@ -20,6 +20,10 @@
"style": "Text",
"text": "Once the synchronization is done, the bot does the accounting (see Accounting), to keep the rest of the variables—like balances and the stage size—up to date with the reality of orders."
},
{
"style": "Block",
"text": "Actual Size Calculation"
},
{
"style": "Title",
"text": "Actual Size Calculation"
@@ -88,6 +92,10 @@
"text": "tradingEngineStage.stageBaseAsset.sizePlaced.value =\ntradingEngineStage.stageBaseAsset.sizePlaced.value -\ntradingEngineOrder.orderBaseAsset.size.value\n\ntradingEngineStage.stageBaseAsset.sizePlaced.value =\ntradingEngineStage.stageBaseAsset.sizePlaced.value +\ntradingEngineOrder.orderBaseAsset.actualSize.value\n\ntradingEngineStage.stageQuotedAsset.sizePlaced.value =\ntradingEngineStage.stageQuotedAsset.sizePlaced.value -\ntradingEngineOrder.orderQuotedAsset.size.value\n\ntradingEngineStage.stageQuotedAsset.sizePlaced.value =\ntradingEngineStage.stageQuotedAsset.sizePlaced.value +\ntradingEngineOrder.orderQuotedAsset.actualSize.value",
"updated": 1610221350195
},
{
"style": "Block",
"text": "Actual Rate Calculation"
},
{
"style": "Title",
"text": "Actual Rate Calculation"
@@ -129,6 +137,10 @@
"style": "Text",
"text": "And remember, the size in the base asset does not need to be recalculated, as it is not affected by the differences in rates."
},
{
"style": "Block",
"text": "Percentage Filled Calculation"
},
{
"style": "Title",
"text": "Percentage Filled Calculation"
@@ -147,6 +159,10 @@
"text": "As you can see, the actual size in the base asset is used, as the size is always denominated in the base asset according to the exchange.",
"updated": 1610221445535
},
{
"style": "Block",
"text": "Fees Paid Calculation"
},
{
"style": "Title",
"text": "Fees Paid Calculation"
@@ -244,6 +260,10 @@
"text": "tradingEngineOrder.orderQuotedAsset.feesPaid.value =\ntradingEngineOrder.orderQuotedAsset.actualSize.value *\nsessionParameters.feeStructure.config.maker / 100 *\ntradingEngineOrder.orderStatistics.percentageFilled.value / 100",
"updated": 1610221607990
},
{
"style": "Block",
"text": "Size Filled Calculation"
},
{
"style": "Title",
"text": "Size Filled Calculation"
@@ -265,6 +285,10 @@
"text": "tradingEngineOrder.orderQuotedAsset.sizeFilled.value =\ntradingEngineOrder.orderQuotedAsset.actualSize.value *\ntradingEngineOrder.orderStatistics.percentageFilled.value / 100",
"updated": 1610221632885
},
{
"style": "Block",
"text": "Amount Received Calculation"
},
{
"style": "Title",
"text": "Amount Received Calculation"
@@ -32,6 +32,10 @@
"style": "Text",
"text": "Like with the real synchronization process, once all calculations are done, the trading bot does the bookkeeping (see Accounting)."
},
{
"style": "Block",
"text": "Actual Size Simulation"
},
{
"style": "Title",
"text": "Actual Size Simulation"
@@ -46,10 +50,14 @@
"updated": 1610222816044
},
{
"style": "Title",
"style": "Block",
"text": "Actual Rate Simulation",
"updated": 1610222855123
},
{
"style": "Title",
"text": "Actual Rate Simulation"
},
{
"style": "Text",
"text": "The initial value for the rate of orders is the close of the last candle for market orders, that is, the last known market rate, and the value defined for the rate node in case of limit orders."
@@ -206,6 +214,10 @@
"text": "tradingEngineOrder.orderStatistics.actualRate.value =\ntradingEngine.current.episode.candle.min.value",
"updated": 1610223044937
},
{
"style": "Block",
"text": "Recalculate Actual Size"
},
{
"style": "Title",
"text": "Recalculate Actual Size"
@@ -219,6 +231,10 @@
"text": "tradingEngineOrder.orderQuotedAsset.actualSize.value =\ntradingEngineOrder.orderBaseAsset.actualSize.value *\ntradingEngineOrder.orderStatistics.actualRate.value",
"updated": 1610223069460
},
{
"style": "Block",
"text": "Recalculate Size Placed"
},
{
"style": "Title",
"text": "Recalculate Size Placed"
@@ -236,6 +252,10 @@
"text": "tradingEngineStage.stageQuotedAsset.sizePlaced.value =\ntradingEngineStage.stageQuotedAsset.sizePlaced.value -\npreviousQuotedAssetActualSize\n\ntradingEngineStage.stageQuotedAsset.sizePlaced.value =\ntradingEngineStage.stageQuotedAsset.sizePlaced.value +\ntradingEngineOrder.orderQuotedAsset.actualSize.value",
"updated": 1610223111181
},
{
"style": "Block",
"text": "Percentage Filled Simulation"
},
{
"style": "Title",
"text": "Percentage Filled Simulation"
@@ -302,6 +322,10 @@
"text": "Of course, there is also a check to make sure that the percentage filled is never greater than 100.",
"updated": 1610223219878
},
{
"style": "Block",
"text": "Fees Paid Simulation"
},
{
"style": "Title",
"text": "Fees Paid Simulation"
@@ -388,6 +412,10 @@
"text": "feesPaid =\ntradingEngineOrder.orderQuotedAsset.actualSize.value *\nsessionParameters.feeStructure.config.maker / 100 *\ntradingEngineOrder.orderStatistics.percentageFilled.value / 100",
"updated": 1610223351171
},
{
"style": "Block",
"text": "Size Filled Simulation"
},
{
"style": "Title",
"text": "Size Filled Simulation"
@@ -401,6 +429,10 @@
"text": "tradingEngineOrder.orderBaseAsset.sizeFilled.value =\ntradingEngineOrder.orderBaseAsset.actualSize.value *\ntradingEngineOrder.orderStatistics.percentageFilled.value / 100\ntradingEngineOrder.orderQuotedAsset.sizeFilled.value =\ntradingEngineOrder.orderQuotedAsset.actualSize.value *\ntradingEngineOrder.orderStatistics.percentageFilled.value / 100",
"updated": 1610223373798
},
{
"style": "Block",
"text": "Amount Received Simulation"
},
{
"style": "Title",
"text": "Amount Received Simulation"
@@ -0,0 +1,62 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "1",
"type": "TS LF Trading Bot Warning - Calculating - Actual Size Recalculated",
"definition": {
"text": "The Actual Size was recalculated because the Actual Rate is different than the Order Rate.",
"updated": 1611817875294
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611818214581
},
{
"style": "Warning",
"text": "Actual Size Recalculated"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Function Involved"
},
{
"style": "Text",
"text": "This warning was triggered at the Recalculate Actual Size Function within the LF Trading Bot.",
"updated": 1611818476005
},
{
"style": "Include",
"text": "Superalgos->Topic->Simulating Sync With the Exchange->Recalculate Actual Size",
"updated": 1611818361744
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Syncing With the Exchange"
},
{
"style": "Text",
"text": ""
}
]
}
@@ -0,0 +1,62 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "2",
"type": "TS LF Trading Bot Warning - Calculating - Size Placed Recalculated",
"definition": {
"text": "The Size Placed was recalculated because the Actual Rate is different than the Order Rate.",
"updated": 1611817875294
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611818214581
},
{
"style": "Warning",
"text": "Size Placed Recalculated"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Function Involved"
},
{
"style": "Text",
"text": "This warning was triggered at the Recalculate Size Placed Function within the LF Trading Bot.",
"updated": 1611818476005
},
{
"style": "Include",
"text": "Superalgos->Topic->Simulating Sync With the Exchange->Recalculate Size Placed",
"updated": 1611818361744
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Syncing With the Exchange"
},
{
"style": "Text",
"text": ""
}
]
}
@@ -0,0 +1,62 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "3",
"type": "TS LF Trading Bot Warning - Simulating - Actual Size Recalculated",
"definition": {
"text": "The Actual Size was recalculated because the Actual Rate is different than the Order Rate.",
"updated": 1611817875294
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611818214581
},
{
"style": "Warning",
"text": "Actual Size Recalculated"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Function Involved"
},
{
"style": "Text",
"text": "This warning was triggered at the Recalculate Actual Size Function within the LF Trading Bot.",
"updated": 1611818476005
},
{
"style": "Include",
"text": "Superalgos->Topic->Simulating Sync With the Exchange->Recalculate Actual Size",
"updated": 1611818361744
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
},
{
"style": "Text",
"text": ""
}
]
}
@@ -0,0 +1,62 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "4",
"type": "TS LF Trading Bot Warning - Simulating - Size Placed Recalculated",
"definition": {
"text": "The Size Placed was recalculated because the Actual Rate is different than the Order Rate.",
"updated": 1611817875294
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611818214581
},
{
"style": "Warning",
"text": "Size Placed Recalculated"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Function Involved"
},
{
"style": "Text",
"text": "This warning was triggered at the Recalculate Size Placed Function within the LF Trading Bot.",
"updated": 1611818476005
},
{
"style": "Include",
"text": "Superalgos->Topic->Simulating Sync With the Exchange->Recalculate Size Placed",
"updated": 1611818361744
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
},
{
"style": "Text",
"text": ""
}
]
}
@@ -0,0 +1,57 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "5",
"type": "TS LF Trading Bot Warning - Simulating - Slippage Substracted",
"definition": {
"text": "Slippage Amount was calculated based on the Session Configuration and substracted from the Order Rate in order to have the Actual Rate. It was subsctracted because what we had was a Market Sell Order.",
"updated": 1611823586499
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611823620818
},
{
"style": "Warning",
"text": "Slippage Substracted"
},
{
"style": "Title",
"text": "Why This?",
"updated": 1611825720103
},
{
"style": "Text",
"text": "Check below how the Actual Rate is treated during a Simulation."
},
{
"style": "Include",
"text": "Superalgos->Topic->Simulating Sync With the Exchange->Actual Rate Simulation"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -0,0 +1,57 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "6",
"type": "TS LF Trading Bot Warning - Simulating - Slippage Added",
"definition": {
"text": "Slippage Amount was calculated based on the Session Configuration and substracted from the Order Rate in order to have the Actual Rate. It was added because what we had was a Market Buy Order.",
"updated": 1611823586499
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611823620818
},
{
"style": "Warning",
"text": "Slippage Added"
},
{
"style": "Title",
"text": "Why This?",
"updated": 1611825659055
},
{
"style": "Text",
"text": "Check below how the Actual Rate is treated during a Simulation."
},
{
"style": "Include",
"text": "Superalgos->Topic->Simulating Sync With the Exchange->Actual Rate Simulation"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -0,0 +1,57 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "7",
"type": "TS LF Trading Bot Warning - Simulating - Actual Rate Based On Formula",
"definition": {
"text": "Because you specified a Formula to simulate the Actual Rate for this order, we use that formula here. Note that this caclulation overrides the calculation based on Slippage.",
"updated": 1611823586499
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611823620818
},
{
"style": "Warning",
"text": "Actual Rate Based On Formula"
},
{
"style": "Title",
"text": "Why This?",
"updated": 1611825630727
},
{
"style": "Text",
"text": "Check below how the Actual Rate is treated during a Simulation."
},
{
"style": "Include",
"text": "Superalgos->Topic->Simulating Sync With the Exchange->Actual Rate Simulation"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -0,0 +1,57 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "8",
"type": "TS LF Trading Bot Warning - Simulating - Actual Rate Too Hight",
"definition": {
"text": "The Actual Rate was adjusted to the Candle Max value because we had a Buy Order whose Actual Rate was above the Current Candle Max.",
"updated": 1611823586499
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611823620818
},
{
"style": "Warning",
"text": "Actual Rate Too Hight"
},
{
"style": "Title",
"text": "Why This?",
"updated": 1611825558276
},
{
"style": "Text",
"text": "Check below how the Actual Rate is treated during a Simulation."
},
{
"style": "Include",
"text": "Superalgos->Topic->Simulating Sync With the Exchange->Actual Rate Simulation"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -0,0 +1,57 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "9",
"type": "TS LF Trading Bot Warning - Simulating - Actual Rate Too Low",
"definition": {
"text": "The Actual Rate was adjusted to the Candle Min value because we had a Sell Order whose Actual Rate was below the Current Candle Min.",
"updated": 1611823586499
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611823620818
},
{
"style": "Warning",
"text": "Actual Rate Too Low"
},
{
"style": "Title",
"text": "Why This?",
"updated": 1611825558276
},
{
"style": "Text",
"text": "Check below how the Actual Rate is treated during a Simulation."
},
{
"style": "Include",
"text": "Superalgos->Topic->Simulating Sync With the Exchange->Actual Rate Simulation"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -0,0 +1,44 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "10",
"type": "TS LF Trading Bot Warning - Skipping Cancel Order Event",
"definition": {
"text": "For some reason we could not check the order status at the exchange, so we can not know if we need to cancel it. In order to avoid with inconsistent information at the accounting level we did not evaluate the conditions of the Cancel Order Event.",
"updated": 1611833530989
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611834454093
},
{
"style": "Important",
"text": "Skipping Cancel Order Event"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -0,0 +1,44 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "11",
"type": "TS LF Trading Bot Warning - Order Size Value Zero Or Negative",
"definition": {
"text": "Even though we should have opened this order, we did not do it. The order could not be opened because it's size is Zero Or Negative.",
"updated": 1611833651413
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611834477590
},
{
"style": "Warning",
"text": "Order Size Value Zero Or Negative"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -0,0 +1,44 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "12",
"type": "TS LF Trading Bot Warning - Order Could Not Be Opened",
"definition": {
"text": "We tried to open this order at the Exchange but it was not possible.",
"updated": 1611833724444
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611834495196
},
{
"style": "Warning",
"text": "Order Coult Not Be Opened"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -0,0 +1,44 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "13",
"type": "TS LF Trading Bot Warning - Order Size Shrinked",
"definition": {
"text": "The Order Size was shrinked so that the Size Placed once the order is filled, does not produce that we go over the Target Size defined for the whole stage.",
"updated": 1611910725966
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611834512006
},
{
"style": "Warning",
"text": "Order Size Shrinked"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -0,0 +1,44 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "14",
"type": "TS LF Trading Bot Warning - Possible Negative Balance",
"definition": {
"text": "The Order Size was recalculated because at it's current value, would leave us with a negative Balance. We set the Order Size equal to the remaining Balance to avoid this situation.",
"updated": 1611834061538
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611834528166
},
{
"style": "Warning",
"text": "Possible Negative Balance"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -0,0 +1,44 @@
{
"topic": "TS LF Trading Bot Warnings",
"pageNumber": "15",
"type": "TS LF Trading Bot Warning - Order Status Not Sync With Exchange",
"definition": {
"text": "For some reason, we could not verify the status of this order at the exchange. This means that the accounting or other actions that needed to be taken will be suspended until the communication with the exchange is restablished.",
"updated": 1611834233298
},
"paragraphs": [
{
"style": "Text",
"text": "This is normal behaviour you should not worry about. This warning is created in order to let you know that this happened and help you track the details of each trade.",
"updated": 1611834545651
},
{
"style": "Warning",
"text": "Order Status Not Sync With Exchange"
},
{
"style": "Title",
"text": "Context Info"
},
{
"style": "Text",
"text": "The following are the values of variables at the time this warning was created. They might be useful for you to understand what exactly happened."
},
{
"style": "Placeholder",
"text": "contextInfo"
},
{
"style": "Title",
"text": "Learn More"
},
{
"style": "Text",
"text": "To learn more about this topic, please read the following page:"
},
{
"style": "List",
"text": "Simulating Sync With the Exchange"
}
]
}
@@ -143,7 +143,6 @@ exports.newSuperalgosBotModulesOrdersCalculations = function (processIndex) {
recalculateSizePlaced()
function recalculateActualSize() {
if (tradingEngineOrder.orderStatistics.actualRate.value === tradingEngineOrder.rate.value) { return }
/*
Now we know the Actual Rate at which the order was filled. Since the actual rate
is not the same as the Rate we defined for the order, we need to syncronize
@@ -162,10 +161,26 @@ exports.newSuperalgosBotModulesOrdersCalculations = function (processIndex) {
tradingEngineOrder.orderQuotedAsset.actualSize.value = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineOrder.orderQuotedAsset.actualSize.value, 10)
tradingSystem.warnings.push(
const message = 'Calculating - Actual Size Recalculated'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
previousQuotedAssetActualSize: previousQuotedAssetActualSize,
recalculatedQuotedAssetActualSize: tradingEngineOrder.orderQuotedAsset.actualSize.value,
actualRate: tradingEngineOrder.orderStatistics.actualRate.value,
orderRate: tradingEngineOrder.rate.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[tradingEngineOrder.orderQuotedAsset.actualSize.id, tradingEngineOrder.orderStatistics.actualRate.id],
'Actual Size (' + previousQuotedAssetActualSize + ') recalculated (' + tradingEngineOrder.orderQuotedAsset.actualSize.value + ') because the Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') is different than the Order Rate (' + tradingEngineOrder.rate.value + '))'
message,
docs
]
)
}
@@ -186,10 +201,26 @@ exports.newSuperalgosBotModulesOrdersCalculations = function (processIndex) {
tradingEngineStage.stageQuotedAsset.sizePlaced.value = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineStage.stageQuotedAsset.sizePlaced.value, 10)
tradingSystem.warnings.push(
const message = 'Calculating - Size Placed Recalculated'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
previousStageQuotedAssetSizePlaced: previousStageQuotedAssetSizePlaced,
recalculatedStageQuotedAssetSizePlaced: tradingEngineStage.stageQuotedAsset.sizePlaced.value,
actualRate: tradingEngineOrder.orderStatistics.actualRate.value,
orderRate: tradingEngineOrder.rate.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[tradingEngineStage.stageQuotedAsset.sizePlaced.id, tradingEngineOrder.orderStatistics.actualRate.id],
'Size Placed (' + previousStageQuotedAssetSizePlaced + ') recalculated (' + tradingEngineStage.stageQuotedAsset.sizePlaced.value + ') because the Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') is different than the Order Rate (' + tradingEngineOrder.rate.value + '))'
message,
docs
]
)
}
@@ -90,10 +90,25 @@ exports.newSuperalgosBotModulesOrdersSimulations = function (processIndex) {
tradingEngineOrder.orderStatistics.actualRate.value = tradingEngineOrder.rate.value - slippageAmount
tradingEngineOrder.orderStatistics.actualRate.value = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineOrder.orderStatistics.actualRate.value, 10)
tradingSystem.warnings.push(
const message = 'Simulating - Slippage Substracted'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
slippageAmount: slippageAmount,
orderRate: tradingEngineOrder.rate.value,
actualRate: tradingEngineOrder.orderStatistics.actualRate.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[sessionParameters.slippage.id, tradingEngineOrder.rate.id, tradingEngineOrder.orderStatistics.actualRate.id],
'slippage.config.marketOrderRate Slippage Amount (' + slippageAmount + ') substracted from Order Rate (' + tradingEngineOrder.rate.value + ') to get the Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ')'
message,
docs
]
)
break
@@ -102,10 +117,25 @@ exports.newSuperalgosBotModulesOrdersSimulations = function (processIndex) {
tradingEngineOrder.orderStatistics.actualRate.value = tradingEngineOrder.rate.value + slippageAmount
tradingEngineOrder.orderStatistics.actualRate.value = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineOrder.orderStatistics.actualRate.value, 10)
tradingSystem.warnings.push(
const message = 'Simulating - Slippage Added'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
slippageAmount: slippageAmount,
orderRate: tradingEngineOrder.rate.value,
actualRate: tradingEngineOrder.orderStatistics.actualRate.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[sessionParameters.slippage.id, tradingEngineOrder.rate.id, tradingEngineOrder.orderStatistics.actualRate.id],
'slippage.config.marketOrderRate Slippage Amount (' + slippageAmount + ') added to Order Rate (' + tradingEngineOrder.rate.value + ') to get the Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ')'
message,
docs
]
)
break
@@ -136,10 +166,24 @@ exports.newSuperalgosBotModulesOrdersSimulations = function (processIndex) {
let newValue = tradingSystem.formulas.get(tradingSystemOrder.simulatedExchangeEvents.simulatedActualRate.formula.id)
newValue = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(newValue, 10)
tradingSystem.warnings.push(
const message = 'Simulating - Actual Rate Based On Formula'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
previousActualRate: tradingEngineOrder.orderStatistics.actualRate.value,
recalculatedActualRate: newValue
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
tradingSystemOrder.simulatedExchangeEvents.simulatedActualRate.formula.id,
'Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') calculated with this Formula (' + newValue + ')'
message,
docs
]
)
tradingEngineOrder.orderStatistics.actualRate.value = newValue
@@ -164,10 +208,25 @@ exports.newSuperalgosBotModulesOrdersSimulations = function (processIndex) {
switch (true) {
case tradingSystemOrder.type === 'Market Buy Order' || tradingSystemOrder.type === 'Limit Buy Order': {
if (tradingEngineOrder.orderStatistics.actualRate.value > tradingEngine.current.episode.candle.max.value) {
tradingSystem.warnings.push(
const message = 'Simulating - Actual Rate Too Hight'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
previousActualRate: tradingEngineOrder.orderStatistics.actualRate.value,
recalculatedActualRate: tradingEngine.current.episode.candle.max.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[tradingEngineOrder.orderStatistics.actualRate.id, tradingEngine.current.episode.candle.max.id],
'Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') too high. Changed to candle.max (' + tradingEngine.current.episode.candle.max.value + ')'
message,
docs
]
)
tradingEngineOrder.orderStatistics.actualRate.value = tradingEngine.current.episode.candle.max.value
@@ -176,10 +235,25 @@ exports.newSuperalgosBotModulesOrdersSimulations = function (processIndex) {
}
case tradingSystemOrder.type === 'Market Sell Order' || tradingSystemOrder.type === 'Limit Sell Order': {
if (tradingEngineOrder.orderStatistics.actualRate.value < tradingEngine.current.episode.candle.min.value) {
tradingSystem.warnings.push(
const message = 'Simulating - Actual Rate Too Low'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
previousActualRate: tradingEngineOrder.orderStatistics.actualRate.value,
recalculatedActualRate: tradingEngine.current.episode.candle.max.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[tradingEngineOrder.orderStatistics.actualRate.id, tradingEngine.current.episode.candle.min.id],
'Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') too low. Changed to candle.min (' + tradingEngine.current.episode.candle.max.value + ')'
message,
docs
]
)
tradingEngineOrder.orderStatistics.actualRate.value = tradingEngine.current.episode.candle.min.value
@@ -202,10 +276,26 @@ exports.newSuperalgosBotModulesOrdersSimulations = function (processIndex) {
tradingEngineOrder.orderQuotedAsset.actualSize.value = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineOrder.orderQuotedAsset.actualSize.value, 10)
tradingSystem.warnings.push(
const message = 'Simulating - Actual Size Recalculated'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
previousQuotedAssetActualSize: previousQuotedAssetActualSize,
recalculatedQuotedAssetActualSize: tradingEngineOrder.orderQuotedAsset.actualSize.value,
actualRate: tradingEngineOrder.orderStatistics.actualRate.value,
orderRate: tradingEngineOrder.rate.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[tradingEngineOrder.orderQuotedAsset.actualSize.id, tradingEngineOrder.orderStatistics.actualRate.id],
'Actual Size (' + previousQuotedAssetActualSize + ') recalculated (' + tradingEngineOrder.orderQuotedAsset.actualSize.value + ') because the Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') is different than the Order Rate (' + tradingEngineOrder.rate.value + '))'
message,
docs
]
)
}
@@ -231,10 +321,26 @@ exports.newSuperalgosBotModulesOrdersSimulations = function (processIndex) {
tradingEngineStage.stageQuotedAsset.sizePlaced.value = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineStage.stageQuotedAsset.sizePlaced.value, 10)
tradingSystem.warnings.push(
const message = 'Simulating - Size Placed Recalculated'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
previousStageQuotedAssetSizePlaced: previousStageQuotedAssetSizePlaced,
recalculatedStageQuotedAssetSizePlaced: tradingEngineStage.stageQuotedAsset.sizePlaced.value,
actualRate: tradingEngineOrder.orderStatistics.actualRate.value,
orderRate: tradingEngineOrder.rate.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[tradingEngineStage.stageQuotedAsset.sizePlaced.id, tradingEngineOrder.orderStatistics.actualRate.id],
'Size Placed (' + previousStageQuotedAssetSizePlaced + ') recalculated (' + tradingEngineStage.stageQuotedAsset.sizePlaced.value + ') because the Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') is different than the Order Rate (' + tradingEngineOrder.rate.value + '))'
message,
docs
]
)
}
@@ -158,13 +158,23 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
if (allGood !== true) {
/*
For some reason we could not check the order at the exchange, so we will not even check if we
need to cancel it, since we could end up with inconsisten information at the accounting level.
need to cancel it, since we could end up with inconsistent information at the accounting level.
*/
if (tradingSystemOrder.cancelOrderEvent !== undefined) {
tradingSystem.warnings.push(
const message = 'Skipping Cancel Order Event'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
tradingSystem.addWarning(
[
tradingSystemOrder.cancelOrderEvent.id,
'Skipping Cancel Event Checking because cheking the order at the exchange failed.'
message,
docs
]
)
}
@@ -234,7 +244,7 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
if (tradingEngineOrder.rate === undefined) { badDefinitionUnhandledException(undefined, 'Rate Node Missing', tradingEngineOrder) }
if (tradingEngineOrder.status === undefined) { badDefinitionUnhandledException(undefined, 'Status Node Missing', tradingEngineOrder) }
if (tradingEngineOrder.algorithmName === undefined) { badDefinitionUnhandledException(undefined, 'Algorithm Name Node Missing', tradingEngineOrder) }
if (tradingEngineOrder.orderCounters === undefined) { badDefinitionUnhandledException(undefined, 'Order Counters Node Missing', tradingEngineOrder) }
if (tradingEngineOrder.orderCounters.periods === undefined) { badDefinitionUnhandledException(undefined, 'Periods Node Missing', tradingEngineOrder.orderCounters) }
@@ -267,20 +277,40 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
/* Check Size: We are not going to create Orders which size is equal or less to zero. */
if (tradingEngineOrder.orderBaseAsset.size.value <= 0) {
tradingSystem.warnings.push(
const message = 'Order Size Value Zero Or Negative'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
tradingSystem.addWarning(
[
[tradingEngineOrder.orderBaseAsset.size.id, tradingSystemOrder.id],
'Could not open this order because its size is zero.'
message,
docs
]
)
return
}
if (tradingEngineOrder.orderQuotedAsset.size.value <= 0) {
tradingSystem.warnings.push(
const message = 'Order Size Value Zero Or Negative'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
tradingSystem.addWarning(
[
[tradingEngineOrder.orderQuotedAsset.size.id, tradingSystemOrder.id],
'Could not open this order because its size is zero.'
message,
docs
]
)
return
@@ -289,10 +319,20 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
/* Place Order at the Exchange, if needed. */
let result = await createOrderAtExchange(tradingSystemOrder, tradingEngineOrder)
if (result !== true) {
tradingSystem.warnings.push(
const message = 'Order Could Not Be Opened'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
tradingSystem.addWarning(
[
[tradingSystemOrder.id, tradingEngineOrder],
'Could not open this order because something failed placing the order at the Exchange.'
message,
docs
]
)
return
@@ -397,10 +437,26 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
tradingEngineOrder.orderBaseAsset.size.value = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineOrder.orderBaseAsset.size.value, 10)
tradingSystem.warnings.push(
const message = 'Order Size Shrinked'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
previousOrderSize: previousValue,
recalculatedOrderSize: tradingEngineOrder.orderBaseAsset.size.value,
sizePlaced: tradingEngineStage.stageBaseAsset.sizePlaced.value,
targetSize: tradingEngineStage.stageBaseAsset.targetSize.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[tradingEngineStage.stageBaseAsset.targetSize.id, tradingEngineOrder.orderBaseAsset.size.id, tradingEngineStage.stageBaseAsset.sizePlaced.id],
'Order size (' + previousValue + ') shrinked (' + tradingEngineOrder.orderBaseAsset.size.value + ') so that the Size Placed (' + tradingEngineStage.stageBaseAsset.sizePlaced.value + ') does not exceed the Target Size (' + tradingEngineStage.stageBaseAsset.targetSize.value + ') for the stage.'
message,
docs
]
)
}
@@ -427,10 +483,26 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
tradingEngineOrder.orderQuotedAsset.size.value = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineOrder.orderQuotedAsset.size.value, 10)
tradingSystem.warnings.push(
const message = 'Order Size Shrinked'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
previousOrderSize: previousValue,
recalculatedOrderSize: tradingEngineOrder.orderQuotedAsset.size.value,
sizePlaced: tradingEngineStage.stageQuotedAsset.sizePlaced.value,
targetSize: tradingEngineStage.stageQuotedAsset.targetSize.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[tradingEngineStage.stageQuotedAsset.targetSize.id, tradingEngineOrder.orderQuotedAsset.size.id, tradingEngineStage.stageQuotedAsset.sizePlaced.id],
'Order size (' + previousValue + ') shrinked (' + tradingEngineOrder.orderQuotedAsset.size.value + ') so that the Size Placed (' + tradingEngineStage.stageQuotedAsset.sizePlaced.value + ') does not exceed the Target Size (' + tradingEngineStage.stageQuotedAsset.targetSize.value + ') for the stage.'
message,
docs
]
)
}
@@ -450,10 +522,24 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
if (
tradingEngine.current.episode.episodeQuotedAsset.balance.value - tradingEngineOrder.orderQuotedAsset.size.value < 0
) {
tradingSystem.warnings.push(
const message = 'Possible Negative Balance'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
orderQuotedAssetSize: tradingEngineOrder.orderQuotedAsset.size.value,
episodeQuotedAssetBalance: tradingEngine.current.episode.episodeQuotedAsset.balance.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[tradingEngine.current.episode.episodeQuotedAsset.balance.id, tradingEngineOrder.orderQuotedAsset.size.id],
'Order Size Quoted Asset (' + tradingEngineOrder.orderQuotedAsset.size.value + ') changed to Balance Quoted Asset (' + tradingEngine.current.episode.episodeQuotedAsset.balance.value + ') so that the Balance does not drop below zero.'
message,
docs
]
)
@@ -466,10 +552,24 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
if (
tradingEngine.current.episode.episodeBaseAsset.balance.value - tradingEngineOrder.orderBaseAsset.size.value < 0
) {
tradingSystem.warnings.push(
const message = 'Possible Negative Balance'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
contextInfo = {
orderBaseAssetSize: tradingEngineOrder.orderBaseAsset.size.value,
episodeBaseAssetBalance: tradingEngine.current.episode.episodeBaseAsset.balance.value
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
tradingSystem.addWarning(
[
[tradingEngine.current.episode.episodeBaseAsset.balance.id, tradingEngineOrder.orderBaseAsset.size.id],
'Order Size Base Asset (' + tradingEngineOrder.orderBaseAsset.size.value + ') changed to Balance Base Asset (' + tradingEngine.current.episode.episodeBaseAsset.balance.value + ') so that the Balance does not drop below zero.'
message,
docs
]
)
@@ -533,10 +633,20 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
let order = await exchangeAPIModuleObject.getOrder(tradingSystemOrder, tradingEngineOrder)
if (order === undefined) {
tradingSystem.warnings.push(
const message = 'Order Status Not Sync With Exchange'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
tradingSystem.addWarning(
[
[tradingSystemOrder.id, tradingEngineOrder.id],
'Could not verify the status of this order at the exchange.'
message,
docs
]
)
return false
@@ -910,10 +1020,20 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
let order = await exchangeAPIModuleObject.getOrder(tradingSystemOrder, tradingEngineOrder)
if (order === undefined) {
tradingSystem.warnings.push(
const message = 'Order Status Not Sync With Exchange'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Warning - ' + message,
placeholder: {}
}
tradingSystem.addWarning(
[
[tradingSystemOrder.id, tradingEngineOrder.id],
'Could not verify the status of this order at the exchange, and syncronize the accounting.'
message,
docs
]
)
return false
@@ -68,10 +68,22 @@ exports.newSuperalgosBotModulesTradingSystem = function (processIndex) {
already at the errors array. This rate will later help plotting the error at the
charts.
*/
let baseRate = tradingEngine.current.episode.candle.close.value
let rate = baseRate - baseRate * ((tradingSystem.errors.length + 1) + 0) / 100
errorInfoArray.push(rate)
tradingSystem.errors.push(errorInfoArray)
let baseRate = tradingEngine.current.episode.candle.close.value
let rate = baseRate - baseRate * ((tradingSystem.errors.length + 1) + 0) / 100
errorInfoArray.push(rate)
tradingSystem.errors.push(errorInfoArray)
}
tradingSystem.addWarning = function (warningInfoArray) {
/*
This function adds to the array of warning info a rate based on the amount of items
already at the warning array. This rate will later help plotting the warning at the
charts.
*/
let baseRate = tradingEngine.current.episode.candle.close.value
let rate = baseRate + baseRate * ((tradingSystem.warnings.length + 1) + 0) / 100
warningInfoArray.push(rate)
tradingSystem.warnings.push(warningInfoArray)
}
function isItInside(elementWithTimestamp, elementWithBeginEnd) {
@@ -1,7 +1,7 @@
function newNodesWarnings() {
const MODULE_NAME = 'Nodes Warnings'
const logger = newWebDebugLog()
let thisObject = {
onRecordChange: onRecordChange,
@@ -21,27 +21,84 @@ function newNodesWarnings() {
function onRecordChange(currentRecord) {
if (currentRecord === undefined) { return }
let array = currentRecord.warnings
if (array === undefined) { return }
for (let i = 0; i < array.length; i++) {
let arrayItem = array[i]
if (currentRecord.rateIndex === undefined) {
/*
The user is not pointing to any rate in particular, so we are
going to report all warnings to the nodes involved.
*/
let array = currentRecord.warnings
if (array === undefined) { return }
for (let i = 0; i < array.length; i++) {
let arrayItem = array[i]
let docs = arrayItem[2]
let nodeIdArray = arrayItem[0]
/* We migth receive here and array of node Ids. If we dont, we receive at least one node id*/
if (Array.isArray(nodeIdArray) === true) {
for (let j = 0; j < nodeIdArray.length; j++) {
let nodeId = nodeIdArray[j]
let value = arrayItem[1]
applyValue(nodeId, value, docs)
}
} else {
let nodeId = arrayItem[0]
let value = arrayItem[1]
applyValue(nodeId, value, docs)
}
}
} else {
/*
The user is pointing to a particular rate, so we are
going to report only that warning and we will open the docs
to show the warning's page.
*/
let array = currentRecord.warnings
if (array === undefined) { return }
let arrayItem = array[currentRecord.rateIndex]
let docs = arrayItem[2]
let nodeId
let nodeIdArray = arrayItem[0]
/* We migth receive here and array of node Ids. If we dont, we receive at least one node id*/
if (Array.isArray(nodeIdArray) === true) {
for (let j = 0; j < nodeIdArray.length; j++) {
let nodeId = nodeIdArray[j]
let value = arrayItem[1]
applyValue(nodeId, value)
}
/* For repositioning the design space we will pick the first Id at the Node Id Array */
nodeId = nodeIdArray[0]
} else {
let nodeId = arrayItem[0]
nodeId = arrayItem[0]
let value = arrayItem[1]
applyValue(nodeId, value)
applyValue(nodeId, value, docs)
}
if (UI.projects.superalgos.spaces.docsSpace.sidePanelTab.isOpen === true) {
if (
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project !== docs.project ||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category !== docs.category ||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type !== docs.type ||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId !== nodeId
) {
UI.projects.superalgos.spaces.docsSpace.navigateTo(
docs.project,
docs.category,
docs.type,
docs.anchor,
nodeId,
docs.placeholder
)
}
} else {
UI.projects.superalgos.spaces.docsSpace.openSpaceAreaAndNavigateTo(
docs.project,
docs.category,
docs.type,
docs.anchor,
nodeId,
docs.placeholder
)
}
}
}
async function applyValue(nodeId, value) {
async function applyValue(nodeId, value, docs) {
if (UI.projects.superalgos.spaces.chartingSpace.visible !== true) { return }
let node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(nodeId)
if (node === undefined) { return }
@@ -50,7 +107,7 @@ function newNodesWarnings() {
if (value === '') {
node.payload.uiObject.resetWarningMessage()
} else {
node.payload.uiObject.setWarningMessage(value, 3)
node.payload.uiObject.setWarningMessage(value, 3, docs)
}
}
}