Refactoring simulationLogic
This commit is contained in:
1 parent
648885d3b0
commit
23c70934ab
3 files changed
+18
-18
No files matched your search
+12
-12
@@ -59,7 +59,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
strategiesArray,
|
||||
tradesArray,
|
||||
lastObjectsArray,
|
||||
simulationLogic,
|
||||
tradingSystem,
|
||||
timePeriod,
|
||||
currentDay,
|
||||
startDate,
|
||||
@@ -256,7 +256,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
|
||||
}
|
||||
|
||||
simulationLogic.strategies = await getStrategies();
|
||||
tradingSystem.strategies = await getStrategies();
|
||||
|
||||
/* Main Simulation Loop: We go thourgh all the candles at this time period. */
|
||||
|
||||
@@ -325,9 +325,9 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
conditionsArrayRecord.push(candle.begin);
|
||||
conditionsArrayRecord.push(candle.end);
|
||||
|
||||
for (let j = 0; j < simulationLogic.strategies.length; j++) {
|
||||
for (let j = 0; j < tradingSystem.strategies.length; j++) {
|
||||
|
||||
let strategy = simulationLogic.strategies[j];
|
||||
let strategy = tradingSystem.strategies[j];
|
||||
|
||||
for (let k = 0; k < strategy.entryPoint.situations.length; k++) {
|
||||
|
||||
@@ -455,9 +455,9 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
|
||||
function checkEntryPoints() {
|
||||
|
||||
for (let j = 0; j < simulationLogic.strategies.length; j++) {
|
||||
for (let j = 0; j < tradingSystem.strategies.length; j++) {
|
||||
|
||||
let strategy = simulationLogic.strategies[j];
|
||||
let strategy = tradingSystem.strategies[j];
|
||||
|
||||
for (let k = 0; k < strategy.entryPoint.situations.length; k++) {
|
||||
|
||||
@@ -496,7 +496,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
|
||||
function checkExitPoints() {
|
||||
|
||||
let strategy = simulationLogic.strategies[strategyNumber - 1];
|
||||
let strategy = tradingSystem.strategies[strategyNumber - 1];
|
||||
|
||||
for (let k = 0; k < strategy.exitPoint.situations.length; k++) {
|
||||
|
||||
@@ -601,7 +601,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
|
||||
function checkSellPoints() {
|
||||
|
||||
let strategy = simulationLogic.strategies[strategyNumber - 1];
|
||||
let strategy = tradingSystem.strategies[strategyNumber - 1];
|
||||
|
||||
for (let k = 0; k < strategy.sellPoint.situations.length; k++) {
|
||||
|
||||
@@ -644,7 +644,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
|
||||
function checkStopPhases() {
|
||||
|
||||
let strategy = simulationLogic.strategies[strategyNumber - 1];
|
||||
let strategy = tradingSystem.strategies[strategyNumber - 1];
|
||||
let phase = strategy.stopLoss.phases[stopLossPhase - 1];
|
||||
|
||||
for (let k = 0; k < phase.situations.length; k++) {
|
||||
@@ -673,7 +673,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
|
||||
function checkStopLoss() {
|
||||
|
||||
let strategy = simulationLogic.strategies[strategyNumber - 1];
|
||||
let strategy = tradingSystem.strategies[strategyNumber - 1];
|
||||
let phase = strategy.stopLoss.phases[stopLossPhase - 1];
|
||||
|
||||
try {
|
||||
@@ -707,7 +707,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
|
||||
function checkBuyOrderPhases() {
|
||||
|
||||
let strategy = simulationLogic.strategies[strategyNumber - 1];
|
||||
let strategy = tradingSystem.strategies[strategyNumber - 1];
|
||||
let phase = strategy.buyOrder.phases[buyOrderPhase - 1];
|
||||
|
||||
for (let k = 0; k < phase.situations.length; k++) {
|
||||
@@ -736,7 +736,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
|
||||
function checkBuyOrder() {
|
||||
|
||||
let strategy = simulationLogic.strategies[strategyNumber - 1];
|
||||
let strategy = tradingSystem.strategies[strategyNumber - 1];
|
||||
let phase = strategy.buyOrder.phases[buyOrderPhase - 1];
|
||||
|
||||
try {
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
let strategiesArray = [];
|
||||
let tradesArray = [];
|
||||
|
||||
let simulationLogic = {};
|
||||
let tradingSystem = {};
|
||||
let lastObjectsArray = [];
|
||||
|
||||
commons.initializeData();
|
||||
@@ -113,7 +113,7 @@
|
||||
strategiesArray,
|
||||
tradesArray,
|
||||
lastObjectsArray,
|
||||
simulationLogic,
|
||||
tradingSystem,
|
||||
timePeriod,
|
||||
currentDay,
|
||||
startDate,
|
||||
@@ -260,7 +260,7 @@
|
||||
}
|
||||
|
||||
fileContent = "[" + fileContent + "]";
|
||||
fileContent = "[" + JSON.stringify(simulationLogic) + "," + JSON.stringify(lastObjectsArray) + "," + fileContent + "]";
|
||||
fileContent = "[" + JSON.stringify(tradingSystem) + "," + JSON.stringify(lastObjectsArray) + "," + fileContent + "]";
|
||||
|
||||
let dateForPath = currentDay.getUTCFullYear() + '/' + utilities.pad(currentDay.getUTCMonth() + 1, 2) + '/' + utilities.pad(currentDay.getUTCDate(), 2);
|
||||
let fileName = '' + market.assetA + '_' + market.assetB + '.json';
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
let tradesArray = [];
|
||||
let lastObjectsArray = [];
|
||||
|
||||
let simulationLogic = {};
|
||||
let tradingSystem = {};
|
||||
let interExecutionMemory = {};
|
||||
let currentDay = bot.processDatetime;
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
strategiesArray,
|
||||
tradesArray,
|
||||
lastObjectsArray,
|
||||
simulationLogic,
|
||||
tradingSystem,
|
||||
timePeriod,
|
||||
currentDay,
|
||||
startDate,
|
||||
@@ -250,7 +250,7 @@
|
||||
}
|
||||
|
||||
fileContent = "[" + fileContent + "]";
|
||||
fileContent = "[" + JSON.stringify(simulationLogic) + "," + JSON.stringify(lastObjectsArray) + "," + fileContent + "]";
|
||||
fileContent = "[" + JSON.stringify(tradingSystem) + "," + JSON.stringify(lastObjectsArray) + "," + fileContent + "]";
|
||||
let fileName = '' + market.assetA + '_' + market.assetB + '.json';
|
||||
|
||||
let filePathRoot = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + global.EXCHANGE_NAME + "/" + bot.dataSetVersion;
|
||||
|
||||
Reference in new issue
Block a user