Warning Handling Improved at the LF Trading Engine
This commit is contained in:
1 parent
ba5c151f53
commit
2e9f809f37
11 files changed
+552
-9
No files matched your search
+24
@@ -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"
|
||||
|
||||
+33
-1
@@ -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"
|
||||
|
||||
+62
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
+62
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
+62
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
+62
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"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": "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"
|
||||
}
|
||||
]
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"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": "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"
|
||||
}
|
||||
]
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"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": "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"
|
||||
}
|
||||
]
|
||||
}
|
||||
+34
-3
@@ -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)
|
||||
|
||||
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.warnings.push(
|
||||
[
|
||||
[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)
|
||||
|
||||
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.warnings.push(
|
||||
[
|
||||
[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
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
+81
-5
@@ -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)
|
||||
|
||||
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.warnings.push(
|
||||
[
|
||||
[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)
|
||||
|
||||
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.warnings.push(
|
||||
[
|
||||
[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)
|
||||
|
||||
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.warnings.push(
|
||||
[
|
||||
tradingSystemOrder.simulatedExchangeEvents.simulatedActualRate.formula.id,
|
||||
'Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') calculated with this Formula (' + newValue + ')'
|
||||
message,
|
||||
docs
|
||||
]
|
||||
)
|
||||
tradingEngineOrder.orderStatistics.actualRate.value = newValue
|
||||
@@ -202,10 +246,26 @@ exports.newSuperalgosBotModulesOrdersSimulations = function (processIndex) {
|
||||
|
||||
tradingEngineOrder.orderQuotedAsset.actualSize.value = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineOrder.orderQuotedAsset.actualSize.value, 10)
|
||||
|
||||
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.warnings.push(
|
||||
[
|
||||
[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 +291,26 @@ exports.newSuperalgosBotModulesOrdersSimulations = function (processIndex) {
|
||||
|
||||
tradingEngineStage.stageQuotedAsset.sizePlaced.value = TS.projects.superalgos.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineStage.stageQuotedAsset.sizePlaced.value, 10)
|
||||
|
||||
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.warnings.push(
|
||||
[
|
||||
[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
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user