bot.simulationState.tradingSystem
This commit is contained in:
1 parent
7c279e46dc
commit
07a9712239
9 files changed
+20
-24
No files matched your search
@@ -14,7 +14,7 @@ exports.newAnnouncements = function newAnnouncements(bot, logger) {
|
||||
return thisObject
|
||||
|
||||
function initialize() {
|
||||
tradingEngine = bot.TRADING_ENGINE
|
||||
tradingEngine = bot.simulationState.tradingEngine
|
||||
}
|
||||
|
||||
function finalize() {
|
||||
|
||||
@@ -39,7 +39,7 @@ exports.newSnapshots = function newSnapshots(bot, logger) {
|
||||
return thisObject
|
||||
|
||||
function initialize() {
|
||||
tradingEngine = bot.TRADING_ENGINE
|
||||
tradingEngine = bot.simulationState.tradingEngine
|
||||
}
|
||||
|
||||
function finalize() {
|
||||
|
||||
@@ -22,7 +22,7 @@ exports.newTradingEngine = function newTradingEngine(bot, logger) {
|
||||
function initialize() {
|
||||
/* Here we will go through all the nodes in the Trading Engine hiriarchy and apply the initial value to the value property when needed */
|
||||
|
||||
tradingEngine = bot.TRADING_ENGINE
|
||||
tradingEngine = bot.simulationState.tradingEngine
|
||||
|
||||
if (tradingEngine.isInitialized !== true || bot.RESUME === false) {
|
||||
tradingEngine.isInitialized = true
|
||||
|
||||
@@ -15,7 +15,7 @@ exports.newTradingExecution = function newTradingExecution(bot, logger) {
|
||||
|
||||
function initialize() {
|
||||
|
||||
tradingEngine = bot.TRADING_ENGINE
|
||||
tradingEngine = bot.simulationState.tradingEngine
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ exports.newTradingOutput = function newTradingOutput(bot, logger, UTILITIES, FIL
|
||||
}
|
||||
}
|
||||
|
||||
function start(chart, timeFrame, timeFrameLabel, currentDay, simulationState, callBackFunction) {
|
||||
function start(chart, timeFrame, timeFrameLabel, currentDay, callBackFunction) {
|
||||
try {
|
||||
bot.processingDailyFiles
|
||||
if (timeFrame > global.dailyFilePeriods[0][0]) {
|
||||
@@ -54,8 +54,8 @@ exports.newTradingOutput = function newTradingOutput(bot, logger, UTILITIES, FIL
|
||||
let outputDatasetsMap = new Map()
|
||||
|
||||
if (bot.RESUME !== true) {
|
||||
simulationState.tradingEngine = bot.SESSION.tradingEngine
|
||||
simulationState.tradingSystem = bot.SESSION.tradingSystem
|
||||
bot.simulationState.tradingEngine = bot.simulationState.tradingEngine
|
||||
bot.simulationState.tradingSystem = bot.simulationState.tradingSystem
|
||||
}
|
||||
readFiles()
|
||||
return
|
||||
@@ -146,7 +146,6 @@ exports.newTradingOutput = function newTradingOutput(bot, logger, UTILITIES, FIL
|
||||
function runSimulation() {
|
||||
tradingSimulation.runSimulation(
|
||||
chart,
|
||||
simulationState,
|
||||
outputDatasetsMap,
|
||||
writeFiles,
|
||||
callBackFunction)
|
||||
|
||||
@@ -79,7 +79,6 @@
|
||||
};
|
||||
|
||||
let previousDay; // Holds the date of the previous day relative to the processing date.
|
||||
let simulationState
|
||||
|
||||
getContextVariables();
|
||||
|
||||
@@ -152,8 +151,8 @@
|
||||
}
|
||||
|
||||
thisReport = statusReport.file;
|
||||
simulationState = thisReport.simulationState;
|
||||
if (simulationState === undefined) { simulationState = {} } // This should happen only when there is no status report
|
||||
bot.simulationState = thisReport.simulationState;
|
||||
if (bot.simulationState === undefined) { bot.simulationState = {} } // This should happen only when there is no status report
|
||||
|
||||
if (thisReport.lastFile !== undefined) {
|
||||
if (bot.hasTheBotJustStarted === true && bot.resumeExecution === false) {
|
||||
@@ -594,7 +593,6 @@
|
||||
currentTimeFrame,
|
||||
currentTimeFrameLabel,
|
||||
bot.tradingProcessDate,
|
||||
simulationState,
|
||||
onOutputGenerated);
|
||||
|
||||
function onOutputGenerated(err) {
|
||||
@@ -716,7 +714,7 @@
|
||||
|
||||
thisReport.file.lastExecution = bot.currentDaytime;
|
||||
thisReport.file.lastFile = lastFileDate;
|
||||
thisReport.file.simulationState = simulationState;
|
||||
thisReport.file.simulationState = bot.simulationState;
|
||||
thisReport.save(callBack);
|
||||
|
||||
bot.hasTheBotJustStarted = false;
|
||||
@@ -727,7 +725,7 @@
|
||||
let thisReport = statusDependencies.statusReports.get(reportKey);
|
||||
|
||||
thisReport.file.lastExecution = bot.processDatetime;
|
||||
thisReport.file.simulationState = simulationState;
|
||||
thisReport.file.simulationState = bot.simulationState;
|
||||
thisReport.save(callBack);
|
||||
|
||||
logger.newInternalLoop(bot.codeName, bot.process, bot.tradingProcessDate);
|
||||
|
||||
@@ -15,8 +15,8 @@ exports.newTradingRecords = function newTradingRecords(bot, logger) {
|
||||
return thisObject
|
||||
|
||||
function initialize(pOutputDatasets, pOutputDatasetsMap) {
|
||||
tradingEngine = bot.TRADING_ENGINE
|
||||
tradingSystem = bot.TRADING_SYSTEM
|
||||
tradingEngine = bot.simulationState.tradingEngine
|
||||
tradingSystem = bot.simulationState.tradingSystem
|
||||
outputDatasetsMap = pOutputDatasetsMap // These are the files turned into arrays, stored in a Map by Product codeName.
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,13 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT
|
||||
|
||||
function runSimulation(
|
||||
chart,
|
||||
simulationState,
|
||||
outputDatasetsMap,
|
||||
callback,
|
||||
callBackFunction) {
|
||||
try {
|
||||
|
||||
let tradingSystem = simulationState.tradingSystem
|
||||
let tradingEngine = simulationState.tradingEngine
|
||||
let tradingSystem = bot.simulationState.tradingSystem
|
||||
let tradingEngine = bot.simulationState.tradingEngine
|
||||
let sessionParameters = bot.SESSION.parameters
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, '[INFO] runSimulation -> initialDatetime = ' + sessionParameters.timeRange.config.initialDatetime) }
|
||||
@@ -47,7 +46,7 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, UTILIT
|
||||
|
||||
/* These are the Modules we will need to run the Simulation */
|
||||
|
||||
const EXCHANGE_API = require(global.ROOT_DIR + 'ExchangeAPI');
|
||||
const EXCHANGE_API = require('../ExchangeAPI');
|
||||
exchangeAPI = EXCHANGE_API.newExchangeAPI(logger, bot);
|
||||
exchangeAPI.initialize();
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ exports.newTradingSystem = function newTradingSystem(bot, logger) {
|
||||
return thisObject
|
||||
|
||||
function initialize() {
|
||||
tradingSystem = bot.TRADING_SYSTEM
|
||||
tradingEngine = bot.TRADING_ENGINE
|
||||
tradingSystem = bot.simulationState.tradingSystem
|
||||
tradingEngine = bot.simulationState.tradingEngine
|
||||
|
||||
tradingSystem.highlights = []
|
||||
tradingSystem.conditionsErrors = []
|
||||
@@ -61,11 +61,11 @@ exports.newTradingSystem = function newTradingSystem(bot, logger) {
|
||||
}
|
||||
|
||||
function evalConditions() {
|
||||
evalNode(bot.TRADING_SYSTEM, 'Conditions')
|
||||
evalNode(bot.simulationState.tradingSystem, 'Conditions')
|
||||
}
|
||||
|
||||
function evalFormulas() {
|
||||
evalNode(bot.TRADING_SYSTEM, 'Formulas')
|
||||
evalNode(bot.simulationState.tradingSystem, 'Formulas')
|
||||
}
|
||||
|
||||
function evalNode(node, evaluating) {
|
||||
|
||||
Reference in new issue
Block a user