5 Last Objects written on file
This commit is contained in:
1 parent
55ed967bd5
commit
9b3214c699
3 files changed
+32
-2
No files matched your search
+24
@@ -44,6 +44,7 @@
|
||||
function runSimulation(
|
||||
recordsArray,
|
||||
conditionsArray,
|
||||
lastObjectsArray,
|
||||
simulationLogic,
|
||||
timePeriod,
|
||||
callback) {
|
||||
@@ -477,8 +478,31 @@
|
||||
|
||||
periods++;
|
||||
|
||||
let channel = getElement(bollingerChannelsArray, candle.begin, candle.end);
|
||||
let subChannel = getElement(bollingerSubChannelsArray, candle.begin, candle.end);
|
||||
|
||||
let lastObjects = {
|
||||
candle: JSON.parse(JSON.stringify(candle)),
|
||||
LRC: JSON.parse(JSON.stringify(LRC)),
|
||||
bollingerBand: JSON.parse(JSON.stringify(bollingerBand)),
|
||||
percentageBandwidth: JSON.parse(JSON.stringify(percentageBandwidth)),
|
||||
channel: JSON.parse(JSON.stringify(channel)),
|
||||
subChannel: JSON.parse(JSON.stringify(subChannel)),
|
||||
}
|
||||
|
||||
lastObjects.candle.previous = undefined;
|
||||
lastObjects.LRC.previous = undefined;
|
||||
lastObjects.bollingerBand.previous = undefined;
|
||||
lastObjects.percentageBandwidth.previous = undefined;
|
||||
lastObjects.channel.previous = undefined;
|
||||
lastObjects.subChannel.previous = undefined;
|
||||
|
||||
lastObjectsArray.push(lastObjects);
|
||||
|
||||
if (lastObjectsArray.length > 5) {
|
||||
lastObjectsArray.splice(0,1);
|
||||
}
|
||||
|
||||
let conditions = new Map; // Here we store the conditions values that will be use in the simulator for decision making.
|
||||
let conditionsArrayRecord = []; // These are the records that will be saved in a file for the plotter to consume.
|
||||
let conditionsArrayValues = []; // Here we store the conditions values that will be written on file for the plotter.
|
||||
|
||||
@@ -67,6 +67,8 @@
|
||||
let conditionsArray = [];
|
||||
|
||||
let simulationLogic = {};
|
||||
let lastObjectsArray = [];
|
||||
|
||||
commons.initializeData();
|
||||
|
||||
for (let i = 0; i < dataDependencies.config.length; i++) {
|
||||
@@ -106,6 +108,7 @@
|
||||
commons.runSimulation(
|
||||
recordsArray,
|
||||
conditionsArray,
|
||||
lastObjectsArray,
|
||||
simulationLogic,
|
||||
timePeriod,
|
||||
writeRecordsFile)
|
||||
@@ -242,7 +245,7 @@
|
||||
}
|
||||
|
||||
fileContent = "[" + fileContent + "]";
|
||||
fileContent = "[" + JSON.stringify(simulationLogic) + "," + fileContent + "]";
|
||||
fileContent = "[" + JSON.stringify(simulationLogic) + "," + 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;
|
||||
|
||||
@@ -65,8 +65,10 @@
|
||||
|
||||
let recordsArray = [];
|
||||
let conditionsArray = [];
|
||||
let lastObjectsArray = [];
|
||||
|
||||
let simulationLogic = {};
|
||||
|
||||
commons.initializeData();
|
||||
|
||||
for (let i = 0; i < dataDependencies.config.length; i++) {
|
||||
@@ -106,6 +108,7 @@
|
||||
commons.runSimulation(
|
||||
recordsArray,
|
||||
conditionsArray,
|
||||
lastObjectsArray,
|
||||
simulationLogic,
|
||||
timePeriod,
|
||||
writeRecordsFile)
|
||||
@@ -234,7 +237,7 @@
|
||||
}
|
||||
|
||||
fileContent = "[" + fileContent + "]";
|
||||
fileContent = "[" + JSON.stringify(simulationLogic) + "," + fileContent + "]";
|
||||
fileContent = "[" + JSON.stringify(simulationLogic) + "," + 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