Code Cleaning
This commit is contained in:
1 parent
d296ffeb51
commit
68febdcf74
2 files changed
+46
-8
No files matched your search
@@ -43,11 +43,22 @@ exports.newTradingExecution = function newTradingExecution(bot, logger, tradingE
|
||||
announcementsModule = undefined
|
||||
}
|
||||
|
||||
async function checkExecution(executionNode, stageIsOpening, stageIsClosing, stageSizeLimit, stageOrdersSize, stageFilledSize) {
|
||||
async function checkExecution(
|
||||
executionNode,
|
||||
stageIsOpening,
|
||||
stageIsClosing,
|
||||
stageSizeLimit,
|
||||
stageOrdersSizeInBaseAsset,
|
||||
stageFilledSizeInBaseAsset,
|
||||
stageOrdersSizeInQuotedAsset,
|
||||
stageFilledSizeInQuotedAsset
|
||||
) {
|
||||
|
||||
/* Enforcing Precision Limit */
|
||||
stageSizeLimit.value = global.PRECISE(stageSizeLimit.value, 10)
|
||||
stageOrdersSize.value = global.PRECISE(stageOrdersSize.value, 10)
|
||||
stageOrdersSizeInBaseAsset.value = global.PRECISE(stageOrdersSizeInBaseAsset.value, 10)
|
||||
stageOrdersSizeInBaseAsset.value = global.PRECISE(stageOrdersSizeInBaseAsset.value, 10)
|
||||
stageOrdersSizeInQuotedAsset.value = global.PRECISE(stageOrdersSizeInQuotedAsset.value, 10)
|
||||
stageFilledSizeInQuotedAsset.value = global.PRECISE(stageFilledSizeInQuotedAsset.value, 10)
|
||||
|
||||
await checkExecutionAlgorithms(executionNode)
|
||||
|
||||
|
||||
@@ -551,7 +551,14 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
|
||||
evalConditions(stageNode, 'Open Execution')
|
||||
evalFormulas(stageNode, 'Open Execution')
|
||||
|
||||
await tradingExecutionModule.checkExecution(executionNode, true, false, tradingEngine.current.position.size, tradingEngine.current.position.openStageOrdersSize, tradingEngine.current.position.openStageFilledSize)
|
||||
await tradingExecutionModule.checkExecution(
|
||||
executionNode,
|
||||
true,
|
||||
false,
|
||||
tradingEngine.current.position.size,
|
||||
tradingEngine.current.position.openStageOrdersSize,
|
||||
tradingEngine.current.position.openStageFilledSize
|
||||
)
|
||||
|
||||
/* From here on, the state is officially Open */
|
||||
tradingStrategyModule.updateStageStatus('Open Stage', 'Open')
|
||||
@@ -571,8 +578,14 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
|
||||
evalConditions(stageNode, 'Open Execution')
|
||||
evalFormulas(stageNode, 'Open Execution')
|
||||
|
||||
await tradingExecutionModule.checkExecution(executionNode, false, false, tradingEngine.current.position.size, tradingEngine.current.position.openStageOrdersSize, tradingEngine.current.position.openStageFilledSize)
|
||||
|
||||
await tradingExecutionModule.checkExecution(
|
||||
executionNode,
|
||||
false,
|
||||
false,
|
||||
tradingEngine.current.position.size,
|
||||
tradingEngine.current.position.openStageOrdersSize,
|
||||
tradingEngine.current.position.openStageFilledSize
|
||||
)
|
||||
/*
|
||||
The Open is finished when the fillSize reaches the Position Size.
|
||||
This can happens at any time when we update the filledSize value when we see
|
||||
@@ -605,7 +618,14 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
|
||||
evalConditions(stageNode, 'Open Execution')
|
||||
evalFormulas(stageNode, 'Open Execution')
|
||||
|
||||
await tradingExecutionModule.checkExecution(executionNode, false, true, tradingEngine.current.position.size, tradingEngine.current.position.openStageOrdersSize, tradingEngine.current.position.openStageFilledSize)
|
||||
await tradingExecutionModule.checkExecution(
|
||||
executionNode,
|
||||
false,
|
||||
true,
|
||||
tradingEngine.current.position.size,
|
||||
tradingEngine.current.position.openStageOrdersSize,
|
||||
tradingEngine.current.position.openStageFilledSize
|
||||
)
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -984,7 +1004,14 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
|
||||
evalFormulas(stageNode, 'Close Execution')
|
||||
|
||||
let stageLimitSize = tradingEngine.current.balance.quotedAsset.value / tradingEngine.current.candle.close.value
|
||||
await tradingExecutionModule.checkExecution(executionNode, false, false, stageLimitSize, tradingEngine.current.position.closeStageOrdersSize, tradingEngine.current.position.closeStageFilledSize)
|
||||
await tradingExecutionModule.checkExecution(
|
||||
executionNode,
|
||||
false,
|
||||
false,
|
||||
stageLimitSize,
|
||||
tradingEngine.current.position.closeStageOrdersSize,
|
||||
tradingEngine.current.position.closeStageFilledSize
|
||||
)
|
||||
|
||||
/* Check the Close Stage Event */
|
||||
evalConditions(stageNode, 'Close Stage Event')
|
||||
|
||||
Reference in new issue
Block a user