no more parameters in trading system
This commit is contained in:
1 parent
b2a3659446
commit
42bb8281f1
1 file changed
-126
-126
@@ -238,132 +238,6 @@
|
||||
|
||||
if (tradingSystem !== undefined) {
|
||||
|
||||
/* Applying Trading System Level Parameters */
|
||||
if (tradingSystem.parameters !== undefined) {
|
||||
|
||||
/* Base Asset and Initial Balances. */
|
||||
{
|
||||
if (tradingSystem.parameters.baseAsset !== undefined) {
|
||||
if (tradingSystem.parameters.baseAsset.referenceParent !== undefined) {
|
||||
if (tradingSystem.parameters.baseAsset.referenceParent.referenceParent !== undefined) {
|
||||
|
||||
let code = tradingSystem.parameters.baseAsset.referenceParent.referenceParent.code
|
||||
|
||||
if (code.codeName !== undefined) {
|
||||
bot.VALUES_TO_USE.baseAsset = code.codeName;
|
||||
}
|
||||
|
||||
code = tradingSystem.parameters.baseAsset.code
|
||||
|
||||
if (bot.VALUES_TO_USE.baseAsset === bot.market.baseAsset) {
|
||||
if (code.initialBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.initialBalanceA = code.initialBalance;
|
||||
bot.VALUES_TO_USE.initialBalanceB = 0
|
||||
}
|
||||
if (code.minimumBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.minimumBalanceA = code.minimumBalance;
|
||||
bot.VALUES_TO_USE.minimumBalanceB = 0
|
||||
}
|
||||
if (code.maximumBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.maximumBalanceA = code.maximumBalance;
|
||||
bot.VALUES_TO_USE.maximumBalanceB = 0
|
||||
}
|
||||
} else {
|
||||
if (code.initialBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.initialBalanceB = code.initialBalance;
|
||||
bot.VALUES_TO_USE.initialBalanceA = 0
|
||||
}
|
||||
if (code.minimumBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.minimumBalanceB = code.minimumBalance;
|
||||
bot.VALUES_TO_USE.minimumBalanceA = 0
|
||||
}
|
||||
if (code.maximumBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.maximumBalanceB = code.maximumBalance;
|
||||
bot.VALUES_TO_USE.maximumBalanceA = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Quoted Asset */
|
||||
{
|
||||
if (tradingSystem.parameters.quotedAsset !== undefined) {
|
||||
if (tradingSystem.parameters.quotedAsset.referenceParent !== undefined) {
|
||||
if (tradingSystem.parameters.quotedAsset.referenceParent.referenceParent !== undefined) {
|
||||
|
||||
let code = tradingSystem.parameters.quotedAsset.referenceParent.referenceParent.code
|
||||
|
||||
if (code.codeName !== undefined) {
|
||||
bot.VALUES_TO_USE.quotedAsset = code.codeName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Time Frame */
|
||||
if (tradingSystem.parameters.timeFrame !== undefined) {
|
||||
bot.VALUES_TO_USE.timeFrame = tradingSystem.parameters.timeFrame.code.value
|
||||
}
|
||||
|
||||
/* Slippage */
|
||||
if (tradingSystem.parameters.slippage !== undefined) {
|
||||
if (tradingSystem.parameters.slippage.code !== undefined) {
|
||||
|
||||
let code = tradingSystem.parameters.slippage.code
|
||||
|
||||
if (code.positionRate !== undefined) {
|
||||
bot.VALUES_TO_USE.slippage.positionRate = code.positionRate
|
||||
}
|
||||
if (code.stopLoss !== undefined) {
|
||||
bot.VALUES_TO_USE.slippage.stopLoss = code.stopLoss
|
||||
}
|
||||
if (code.takeProfit !== undefined) {
|
||||
bot.VALUES_TO_USE.slippage.takeProfit = code.takeProfit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fee Structure */
|
||||
if (tradingSystem.parameters.feeStructure !== undefined) {
|
||||
if (tradingSystem.parameters.feeStructure.code !== undefined) {
|
||||
|
||||
let code = tradingSystem.parameters.feeStructure.code
|
||||
|
||||
if (code.maker !== undefined) {
|
||||
bot.VALUES_TO_USE.feeStructure.maker = code.maker
|
||||
}
|
||||
if (code.taker !== undefined) {
|
||||
bot.VALUES_TO_USE.feeStructure.taker = code.taker
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Time Range */
|
||||
if (tradingSystem.parameters.timeRange !== undefined) {
|
||||
if (tradingSystem.parameters.timeRange.code !== undefined) {
|
||||
|
||||
let code = tradingSystem.parameters.timeRange.code
|
||||
if (code.initialDatetime !== undefined) {
|
||||
if (isNaN(Date.parse(code.initialDatetime)) === true) {
|
||||
parentLogger.write(MODULE_NAME, "[WARN] initialize -> runSession -> setValuesToUse -> Cannot use initialDatatime provided at Trading System Parameters because it is not a valid Date.");
|
||||
} else {
|
||||
bot.VALUES_TO_USE.timeRange.initialDatetime = new Date(code.initialDatetime)
|
||||
}
|
||||
}
|
||||
if (code.finalDatetime !== undefined) {
|
||||
if (isNaN(Date.parse(code.finalDatetime)) === true) {
|
||||
parentLogger.write(MODULE_NAME, "[WARN] initialize -> runSession -> setValuesToUse -> Cannot use finalDatetime provided at Trading System Parameters because it is not a valid Date.");
|
||||
} else {
|
||||
bot.VALUES_TO_USE.timeRange.finalDatetime = new Date(code.finalDatetime)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Applying Session Level Parameters */
|
||||
if (bot.SESSION !== undefined) {
|
||||
if (bot.SESSION.parameters !== undefined) {
|
||||
|
||||
Reference in new issue
Block a user