Refactoring and Bug Fixes

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

No files matched your search

@@ -17,7 +17,7 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
let tradingSystem
let tradingEngine
let sessionParameters
let dynamicIndicators
let dynamicIndicators
const TRADING_STAGES_MODULE = require('./TradingStages.js')
let tradingStagesModule = TRADING_STAGES_MODULE.newTradingStages(bot, logger, tradingEngineModule)
@@ -131,8 +131,8 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
for (let i = 0; i < tradingSystem.dynamicIndicators.indicatorFunctions.length; i++) {
let indicatorFunction = tradingSystem.dynamicIndicators.indicatorFunctions[i]
if (indicatorFunction.formula === undefined) { return}
if (indicatorFunction.config.codeName === undefined) { return}
if (indicatorFunction.formula === undefined) { return }
if (indicatorFunction.config.codeName === undefined) { return }
dynamicIndicators[indicatorFunction.config.codeName] = tradingSystem.formulas.get(indicatorFunction.formula.id)
}
}
@@ -257,15 +257,7 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
will not be considered an error.
*/
value = false
if (code.indexOf('previous') > -1 && err.message.indexOf('of undefined') > -1
) {
/*
We are not going to set an error for the casess we are using previous and the error is that the indicator is undefined.
*/
} else {
error = err.message
}
error = err.message
}
tradingSystem.conditions.set(node.id, value)
@@ -297,15 +289,7 @@ exports.newTradingSystem = function newTradingSystem(bot, logger, tradingEngineM
will not be considered an error.
*/
value = 0
if (node.code.indexOf('previous') > -1 && err.message.indexOf('of undefined') > -1
) {
/*
We are not going to set an error for the casess we are using previous and the error is that the indicator is undefined.
*/
} else {
error = err.message
}
error = err.message
}
if (error !== undefined) {