diff --git a/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-005-ts-lf-trading-bot-warning-simulating-slippage-substracted.json b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-005-ts-lf-trading-bot-warning-simulating-slippage-substracted.json index 5f6890d19..9bd542fb4 100644 --- a/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-005-ts-lf-trading-bot-warning-simulating-slippage-substracted.json +++ b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-005-ts-lf-trading-bot-warning-simulating-slippage-substracted.json @@ -16,6 +16,19 @@ "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" diff --git a/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-006-ts-lf-trading-bot-warning-simulating-slippage-added.json b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-006-ts-lf-trading-bot-warning-simulating-slippage-added.json index 18c530cdc..98ad3210e 100644 --- a/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-006-ts-lf-trading-bot-warning-simulating-slippage-added.json +++ b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-006-ts-lf-trading-bot-warning-simulating-slippage-added.json @@ -16,6 +16,19 @@ "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" diff --git a/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-007-ts-lf-trading-bot-warning-simulating-actual-rate-based-on-formula.json b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-007-ts-lf-trading-bot-warning-simulating-actual-rate-based-on-formula.json index 88a69bb3b..f3b6521f6 100644 --- a/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-007-ts-lf-trading-bot-warning-simulating-actual-rate-based-on-formula.json +++ b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-007-ts-lf-trading-bot-warning-simulating-actual-rate-based-on-formula.json @@ -16,6 +16,19 @@ "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" diff --git a/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-008-ts-lf-trading-bot-warning-simulating-actual-rate-too-hight.json b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-008-ts-lf-trading-bot-warning-simulating-actual-rate-too-hight.json new file mode 100644 index 000000000..c469d4c9e --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-008-ts-lf-trading-bot-warning-simulating-actual-rate-too-hight.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-009-ts-lf-trading-bot-warning-simulating-actual-rate-too-low.json b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-009-ts-lf-trading-bot-warning-simulating-actual-rate-too-low.json new file mode 100644 index 000000000..c36273229 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-warnings-009-ts-lf-trading-bot-warning-simulating-actual-rate-too-low.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/OrdersSimulations.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/OrdersSimulations.js index f23aed6d5..8da1ae263 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/OrdersSimulations.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/OrdersSimulations.js @@ -208,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) { + + 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.warnings.push( [ [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 @@ -220,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) { + + 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.warnings.push( [ [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