, logger
This commit is contained in:
1 parent
12b8abb1f3
commit
8ecb9152bf
39 files changed
+85
-85
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
exports.newUserBot = function (processIndex, logger, COMMONS, UTILITIES, FILE_STORAGE) {
|
||||
exports.newUserBot = function (processIndex, COMMONS, UTILITIES, FILE_STORAGE) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
const INTENSIVE_LOG = false;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
exports.newUserBot = function (processIndex, logger, COMMONS, UTILITIES, FILE_STORAGE) {
|
||||
exports.newUserBot = function (processIndex, COMMONS, UTILITIES, FILE_STORAGE) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
const LOG_FILE_CONTENT = false;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
exports.newUserBot = function (processIndex, logger, COMMONS, UTILITIES, FILE_STORAGE) {
|
||||
exports.newUserBot = function (processIndex, COMMONS, UTILITIES, FILE_STORAGE) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
const LOG_FILE_CONTENT = false;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
exports.newUserBot = function (processIndex, logger, COMMONS, UTILITIES, FILE_STORAGE) {
|
||||
exports.newUserBot = function (processIndex, COMMONS, UTILITIES, FILE_STORAGE) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
const LOG_FILE_CONTENT = false;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
exports.newUserBot = function (processIndex, logger, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) {
|
||||
exports.newUserBot = function (processIndex, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
const GMT_SECONDS = ':00.000 GMT+0000';
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
exports.newUserBot = function (processIndex, logger, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) {
|
||||
exports.newUserBot = function (processIndex, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
const LOG_FILE_CONTENT = false;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
exports.newUserBot = function (processIndex, logger, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) {
|
||||
exports.newUserBot = function (processIndex, COMMONS, UTILITIES, FILE_STORAGE, STATUS_REPORT, EXCHANGE_API) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
const LOG_FILE_CONTENT = false;
|
||||
|
||||
@@ -12,7 +12,7 @@ exports.newSuperalgosFunctionLibrariesSessionFunctions = function () {
|
||||
|
||||
return thisObject
|
||||
|
||||
function sessionHeartBeat(processIndex, logger, processingDate, percentage, status) {
|
||||
function sessionHeartBeat(processIndex, processingDate, percentage, status) {
|
||||
let event = {
|
||||
seconds: (new Date()).getSeconds(),
|
||||
processingDate: processingDate,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newDataDependencies = function (processIndex, logger, DATA_SET) {
|
||||
exports.newDataDependencies = function (processIndex, DATA_SET) {
|
||||
|
||||
const MODULE_NAME = "Data Dependencies";
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
let newNodeArray = []
|
||||
|
||||
for (let i = 0; i < thisObject.nodeArray.length; i++) {
|
||||
let dataSetModule = DATA_SET.newDataSet(processIndex, logger);
|
||||
let dataSetModule = DATA_SET.newDataSet(processIndex);
|
||||
dataSetModule.initialize(thisObject.nodeArray[i], onInitilized);
|
||||
|
||||
function onInitilized(err, wasInitialized) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newDataSet = function (processIndex, logger) {
|
||||
exports.newDataSet = function (processIndex) {
|
||||
|
||||
const MODULE_NAME = "Dataset";
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
function initializeProcessExecutionEvents() {
|
||||
try {
|
||||
processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(processIndex, logger)
|
||||
processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(processIndex)
|
||||
processExecutionEvents.initialize(processConfig, onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
@@ -233,7 +233,7 @@
|
||||
|
||||
function initializeStatusDependencies() {
|
||||
try {
|
||||
statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(processIndex, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT);
|
||||
statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(processIndex, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT);
|
||||
statusDependencies.initialize(onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
@@ -281,7 +281,7 @@
|
||||
|
||||
function initializeDataDependencies() {
|
||||
try {
|
||||
dataDependencies = DATA_DEPENDENCIES.newDataDependencies(processIndex, logger, DATA_SET);
|
||||
dataDependencies = DATA_DEPENDENCIES.newDataDependencies(processIndex, DATA_SET);
|
||||
dataDependencies.initialize(onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
@@ -296,12 +296,12 @@
|
||||
|
||||
switch (processConfig.framework.name) {
|
||||
case 'Multi-Period-Market': {
|
||||
processFramework = MULTI_PERIOD_MARKET.newMultiPeriodMarket(processIndex, logger, UTILITIES, FILE_STORAGE);
|
||||
processFramework = MULTI_PERIOD_MARKET.newMultiPeriodMarket(processIndex, UTILITIES, FILE_STORAGE);
|
||||
intitializeProcessFramework();
|
||||
break;
|
||||
}
|
||||
case 'Multi-Period-Daily': {
|
||||
processFramework = MULTI_PERIOD_DAILY.newMultiPeriodDaily(processIndex, logger, UTILITIES, FILE_STORAGE);
|
||||
processFramework = MULTI_PERIOD_DAILY.newMultiPeriodDaily(processIndex, UTILITIES, FILE_STORAGE);
|
||||
intitializeProcessFramework();
|
||||
break;
|
||||
}
|
||||
@@ -353,7 +353,7 @@
|
||||
|
||||
function initializeUserBot() {
|
||||
try {
|
||||
usertBot = USER_BOT_MODULE.newUserBot(processIndex, logger, COMMONS_MODULE, UTILITIES, FILE_STORAGE);
|
||||
usertBot = USER_BOT_MODULE.newUserBot(processIndex, COMMONS_MODULE, UTILITIES, FILE_STORAGE);
|
||||
usertBot.initialize(statusDependencies, onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newIndicatorOutput = function (processIndex, logger, UTILITIES, FILE_STORAGE) {
|
||||
exports.newIndicatorOutput = function (processIndex, UTILITIES, FILE_STORAGE) {
|
||||
const MODULE_NAME = "Indicator Bot";
|
||||
|
||||
let thisObject = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newAnnouncements = function (processIndex, logger) {
|
||||
exports.newAnnouncements = function (processIndex) {
|
||||
|
||||
const MODULE_NAME = 'Announcements'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newExchangeAPI = function (processIndex, logger) {
|
||||
exports.newExchangeAPI = function (processIndex) {
|
||||
|
||||
let MODULE_NAME = "Exchange API";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newOrdersCalculations = function (processIndex, logger) {
|
||||
exports.newOrdersCalculations = function (processIndex) {
|
||||
/*
|
||||
When we are live trading, we need to syncronize with the exchange.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newOrdersSimulations = function (processIndex, logger) {
|
||||
exports.newOrdersSimulations = function (processIndex) {
|
||||
/*
|
||||
When we are backtesting or paper trading, we need to simulate what would have happened at the exchange.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newSnapshots = function (processIndex, logger) {
|
||||
exports.newSnapshots = function (processIndex) {
|
||||
/*
|
||||
This module encapsulates the snapshots functionality.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingEngine = function (processIndex, logger) {
|
||||
exports.newTradingEngine = function (processIndex) {
|
||||
/*
|
||||
We call the Trading Engine to the data structure that is needed in order to exevute the
|
||||
trading protocol with the specific rules defined at the Trading System.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingEpisode = function (processIndex, logger, tradingEngineModule) {
|
||||
exports.newTradingEpisode = function (processIndex, tradingEngineModule) {
|
||||
/*
|
||||
This module packages all functions related to Episodes.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingExecution = function (processIndex, logger, tradingEngineModule) {
|
||||
exports.newTradingExecution = function (processIndex, tradingEngineModule) {
|
||||
/*
|
||||
The Trading Execution modules manages the execution nodes and execution algoritms.
|
||||
*/
|
||||
@@ -17,7 +17,7 @@ exports.newTradingExecution = function (processIndex, logger, tradingEngineModul
|
||||
let sessionParameters
|
||||
|
||||
const TRADING_ORDERS_MODULE = require('./TradingOrders.js')
|
||||
let tradingOrdersModule = TRADING_ORDERS_MODULE.newTradingOrders(processIndex, logger, tradingEngineModule)
|
||||
let tradingOrdersModule = TRADING_ORDERS_MODULE.newTradingOrders(processIndex, tradingEngineModule)
|
||||
|
||||
return thisObject
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingOrders = function (processIndex, logger, tradingEngineModule) {
|
||||
exports.newTradingOrders = function (processIndex, tradingEngineModule) {
|
||||
/*
|
||||
The Trading Orders modules manages the execution of orders against the exchanges.
|
||||
*/
|
||||
@@ -17,10 +17,10 @@ exports.newTradingOrders = function (processIndex, logger, tradingEngineModule)
|
||||
let sessionParameters
|
||||
|
||||
const EXCHANGE_API_MODULE = require('./ExchangeAPI.js')
|
||||
let exchangeAPIModule = EXCHANGE_API_MODULE.newExchangeAPI(processIndex, logger)
|
||||
let exchangeAPIModule = EXCHANGE_API_MODULE.newExchangeAPI(processIndex)
|
||||
|
||||
const ANNOUNCEMENTS_MODULE = require('./Announcements.js')
|
||||
let announcementsModule = ANNOUNCEMENTS_MODULE.newAnnouncements(processIndex, logger)
|
||||
let announcementsModule = ANNOUNCEMENTS_MODULE.newAnnouncements(processIndex)
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -658,7 +658,7 @@ exports.newTradingOrders = function (processIndex, logger, tradingEngineModule)
|
||||
let previousQuotedAssetFeesPaid = tradingEngineOrder.orderQuotedAsset.feesPaid.value
|
||||
|
||||
const ORDERS_SIMULATIONS_MODULE = require('./OrdersSimulations.js')
|
||||
let ordersSimulationsModule = ORDERS_SIMULATIONS_MODULE.newOrdersSimulations(processIndex, logger)
|
||||
let ordersSimulationsModule = ORDERS_SIMULATIONS_MODULE.newOrdersSimulations(processIndex)
|
||||
ordersSimulationsModule.initialize()
|
||||
|
||||
ordersSimulationsModule.actualSizeSimulation(tradingEngineStage, tradingSystemOrder, tradingEngineOrder, applyFeePercentage)
|
||||
@@ -690,7 +690,7 @@ exports.newTradingOrders = function (processIndex, logger, tradingEngineModule)
|
||||
let previousQuotedAssetFeesPaid = tradingEngineOrder.orderQuotedAsset.feesPaid.value
|
||||
|
||||
const ORDERS_CALCULATIONS_MODULE = require('./OrdersCalculations.js')
|
||||
let ordersCalculationsModule = ORDERS_CALCULATIONS_MODULE.newOrdersCalculations(processIndex, logger)
|
||||
let ordersCalculationsModule = ORDERS_CALCULATIONS_MODULE.newOrdersCalculations(processIndex)
|
||||
ordersCalculationsModule.initialize()
|
||||
|
||||
await ordersCalculationsModule.actualSizeCalculation(tradingEngineStage, tradingSystemOrder, tradingEngineOrder, order, applyFeePercentage)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingOutput = function (processIndex, logger, tradingEngineModule, UTILITIES, FILE_STORAGE) {
|
||||
exports.newTradingOutput = function (processIndex, tradingEngineModule, UTILITIES, FILE_STORAGE) {
|
||||
/*
|
||||
This module will load if necesary all the data outputs so that they can be appended with new
|
||||
records if needed. After running the simulation, it will save all the data outputs.
|
||||
@@ -38,7 +38,7 @@ exports.newTradingOutput = function (processIndex, logger, tradingEngineModule,
|
||||
|
||||
/* Preparing everything for the Simulation */
|
||||
const TRADING_SIMULATION = require('./TradingSimulation.js')
|
||||
let tradingSimulation = TRADING_SIMULATION.newTradingSimulation(processIndex, logger, tradingEngineModule, UTILITIES)
|
||||
let tradingSimulation = TRADING_SIMULATION.newTradingSimulation(processIndex, tradingEngineModule, UTILITIES)
|
||||
|
||||
let outputDatasets = TS.projects.superalgos.utilities.nodeFunctions.nodeBranchToArray(TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
|
||||
let outputDatasetsMap = new Map()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingPosition = function (processIndex, logger, tradingEngineModule) {
|
||||
exports.newTradingPosition = function (processIndex, tradingEngineModule) {
|
||||
/*
|
||||
This module packages all functions related to Positions.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingProcess = function (processIndex, logger, UTILITIES) {
|
||||
exports.newTradingProcess = function (processIndex, UTILITIES) {
|
||||
/*
|
||||
This Module will load all the process data dependencies from files and send them downstream.
|
||||
After execution, will save the time range and status report of the process.
|
||||
@@ -24,10 +24,10 @@
|
||||
let fileStorage = FILE_STORAGE.newFileStorage(logger);
|
||||
|
||||
const TRADING_ENGINE_MODULE = require('./TradingEngine.js')
|
||||
let tradingEngineModule = TRADING_ENGINE_MODULE.newTradingEngine(processIndex, logger)
|
||||
let tradingEngineModule = TRADING_ENGINE_MODULE.newTradingEngine(processIndex)
|
||||
|
||||
let TRADING_OUTPUT_MODULE = require("./TradingOutput")
|
||||
let tradingOutputModule = TRADING_OUTPUT_MODULE.newTradingOutput(processIndex, logger, tradingEngineModule, UTILITIES, FILE_STORAGE)
|
||||
let tradingOutputModule = TRADING_OUTPUT_MODULE.newTradingOutput(processIndex, tradingEngineModule, UTILITIES, FILE_STORAGE)
|
||||
|
||||
let processConfig;
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
await processSingleFiles()
|
||||
|
||||
if (await processMarketFiles() === false) {
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Waiting for Data Mining to be run')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Waiting for Data Mining to be run')
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_RETRY_RESPONSE)
|
||||
return
|
||||
}
|
||||
@@ -141,17 +141,17 @@
|
||||
With all the indicators data files loaded, we will build the chart object
|
||||
data structure that will be used in user-defied conditions and formulas.
|
||||
*/
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Waking up')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Waking up')
|
||||
buildCharts(chart)
|
||||
|
||||
if (checkThereAreCandles(chart) === true) {
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Running')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Running')
|
||||
await generateOutput(chart)
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Saving')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Saving')
|
||||
await writeProcessFiles()
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Sleeping')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Sleeping')
|
||||
} else {
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Waiting for Data Mining to be up to date. No candles found at.')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Waiting for Data Mining to be up to date. No candles found at.')
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_RETRY_RESPONSE)
|
||||
return
|
||||
}
|
||||
@@ -171,9 +171,9 @@
|
||||
if (checkStopTaskGracefully() === false) { break }
|
||||
if (checkStopProcessing() === false) { break }
|
||||
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Waking up')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Waking up')
|
||||
if (await processDailyFiles() === false) {
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Waiting for Data Mining to be run')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Waiting for Data Mining to be run')
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_RETRY_RESPONSE)
|
||||
return
|
||||
}
|
||||
@@ -186,13 +186,13 @@
|
||||
The process of generating the output includes the trading simulation.
|
||||
*/
|
||||
if (checkThereAreCandles(chart) === true) {
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Running')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Running')
|
||||
await generateOutput(chart)
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Saving')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Saving')
|
||||
await writeProcessFiles()
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Sleeping')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Sleeping')
|
||||
} else {
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, logger, undefined, undefined, 'Waiting for Data Mining to be up to date')
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionHeartBeat(processIndex, undefined, undefined, 'Waiting for Data Mining to be up to date')
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_RETRY_RESPONSE)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingRecords = function (processIndex, logger) {
|
||||
exports.newTradingRecords = function (processIndex) {
|
||||
/*
|
||||
This module facilitates the appending of records to the output of the process.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingSimulation = function (processIndex, logger, tradingEngineModule, UTILITIES) {
|
||||
exports.newTradingSimulation = function (processIndex, tradingEngineModule, UTILITIES) {
|
||||
/*
|
||||
This Module represents the trading simulacion. Escentially a loop through a set of candles and
|
||||
the execution at each loop cycle of the Trading System Protocol.
|
||||
@@ -35,15 +35,15 @@ exports.newTradingSimulation = function (processIndex, logger, tradingEngineModu
|
||||
|
||||
/* These are the Modules we will need to run the Simulation */
|
||||
const TRADING_RECORDS_MODULE = require('./TradingRecords.js')
|
||||
let tradingRecordsModule = TRADING_RECORDS_MODULE.newTradingRecords(processIndex, logger)
|
||||
let tradingRecordsModule = TRADING_RECORDS_MODULE.newTradingRecords(processIndex)
|
||||
tradingRecordsModule.initialize(outputDatasetsMap)
|
||||
|
||||
const TRADING_SYSTEM_MODULE = require('./TradingSystem.js')
|
||||
let tradingSystemModule = TRADING_SYSTEM_MODULE.newTradingSystem(processIndex, logger, tradingEngineModule)
|
||||
let tradingSystemModule = TRADING_SYSTEM_MODULE.newTradingSystem(processIndex, tradingEngineModule)
|
||||
tradingSystemModule.initialize()
|
||||
|
||||
const TRADING_EPISODE_MODULE = require('./TradingEpisode.js')
|
||||
let tradingEpisodeModule = TRADING_EPISODE_MODULE.newTradingEpisode(processIndex, logger, tradingEngineModule)
|
||||
let tradingEpisodeModule = TRADING_EPISODE_MODULE.newTradingEpisode(processIndex, tradingEngineModule)
|
||||
tradingEpisodeModule.initialize()
|
||||
|
||||
/* Setting up the candles array: The whole simulation is based on the array of candles at the time-frame defined at the session parameters. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingStages = function (processIndex, logger, tradingEngineModule) {
|
||||
exports.newTradingStages = function (processIndex, tradingEngineModule) {
|
||||
/*
|
||||
This module packages all functions related to Stages.
|
||||
*/
|
||||
@@ -21,22 +21,22 @@ exports.newTradingStages = function (processIndex, logger, tradingEngineModule)
|
||||
}
|
||||
|
||||
const TRADING_STRATEGY_MODULE = require('./TradingStrategy.js')
|
||||
let tradingStrategyModule = TRADING_STRATEGY_MODULE.newTradingStrategy(processIndex, logger, tradingEngineModule)
|
||||
let tradingStrategyModule = TRADING_STRATEGY_MODULE.newTradingStrategy(processIndex, tradingEngineModule)
|
||||
|
||||
const TRADING_POSITION_MODULE = require('./TradingPosition.js')
|
||||
let tradingPositionModule = TRADING_POSITION_MODULE.newTradingPosition(processIndex, logger, tradingEngineModule)
|
||||
let tradingPositionModule = TRADING_POSITION_MODULE.newTradingPosition(processIndex, tradingEngineModule)
|
||||
|
||||
const TRADING_ENGINE_EXECUTION = require('./TradingExecution.js')
|
||||
let tradingExecutionModule = TRADING_ENGINE_EXECUTION.newTradingExecution(processIndex, logger, tradingEngineModule)
|
||||
let tradingExecutionModule = TRADING_ENGINE_EXECUTION.newTradingExecution(processIndex, tradingEngineModule)
|
||||
|
||||
const ANNOUNCEMENTS_MODULE = require('./Announcements.js')
|
||||
let announcementsModule = ANNOUNCEMENTS_MODULE.newAnnouncements(processIndex, logger)
|
||||
let announcementsModule = ANNOUNCEMENTS_MODULE.newAnnouncements(processIndex)
|
||||
|
||||
const SNAPSHOTS_MODULE = require('./Snapshots.js')
|
||||
let snapshotsModule = SNAPSHOTS_MODULE.newSnapshots(processIndex, logger)
|
||||
let snapshotsModule = SNAPSHOTS_MODULE.newSnapshots(processIndex)
|
||||
|
||||
const TRADING_EPISODE_MODULE = require('./TradingEpisode.js')
|
||||
let tradingEpisodeModule = TRADING_EPISODE_MODULE.newTradingEpisode(processIndex, logger)
|
||||
let tradingEpisodeModule = TRADING_EPISODE_MODULE.newTradingEpisode(processIndex)
|
||||
|
||||
let tradingEngine
|
||||
let tradingSystem
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingStrategy = function (processIndex, logger, tradingEngineModule) {
|
||||
exports.newTradingStrategy = function (processIndex, tradingEngineModule) {
|
||||
/*
|
||||
This module packages all functions related to Strategies.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newTradingSystem = function (processIndex, logger, tradingEngineModule) {
|
||||
exports.newTradingSystem = function (processIndex, tradingEngineModule) {
|
||||
/*
|
||||
The Trading System is the user defined set of rules compliant with the Trading Protocol that
|
||||
defines the trading logic to be applied during each cycle of the Simulation.
|
||||
@@ -20,7 +20,7 @@ exports.newTradingSystem = function (processIndex, logger, tradingEngineModule)
|
||||
let dynamicIndicators
|
||||
|
||||
const TRADING_STAGES_MODULE = require('./TradingStages.js')
|
||||
let tradingStagesModule = TRADING_STAGES_MODULE.newTradingStages(processIndex, logger, tradingEngineModule)
|
||||
let tradingStagesModule = TRADING_STAGES_MODULE.newTradingStages(processIndex, tradingEngineModule)
|
||||
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newMultiPeriodDaily = function (processIndex, logger, UTILITIES, FILE_STORAGE) {
|
||||
exports.newMultiPeriodDaily = function (processIndex, UTILITIES, FILE_STORAGE) {
|
||||
const MODULE_NAME = "Multi Period Daily";
|
||||
const GMT_SECONDS = ':00.000 GMT+0000';
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
let INDICATOR_OUTPUT_MODULE = require("./IndicatorOutput")
|
||||
|
||||
indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(processIndex, logger, UTILITIES, FILE_STORAGE)
|
||||
indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(processIndex, UTILITIES, FILE_STORAGE)
|
||||
indicatorOutputModule.initialize(callBackFunction)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newMultiPeriodMarket = function (processIndex, logger, UTILITIES, FILE_STORAGE) {
|
||||
exports.newMultiPeriodMarket = function (processIndex, UTILITIES, FILE_STORAGE) {
|
||||
const MODULE_NAME = "Multi Period Market";
|
||||
thisObject = {
|
||||
initialize: initialize,
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
let INDICATOR_OUTPUT_MODULE = require("./IndicatorOutput")
|
||||
|
||||
indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(processIndex, logger, UTILITIES, FILE_STORAGE)
|
||||
indicatorOutputModule = INDICATOR_OUTPUT_MODULE.newIndicatorOutput(processIndex, UTILITIES, FILE_STORAGE)
|
||||
indicatorOutputModule.initialize(callBackFunction)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newProcessExecutionEvents = function (processIndex, logger) {
|
||||
exports.newProcessExecutionEvents = function (processIndex) {
|
||||
/*
|
||||
Here we manage the process execution events. This allow us to emit events
|
||||
when the process starts and finishes. Also to wait for a dependent event
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newProcessOutput = function (processIndex, logger) {
|
||||
exports.newProcessOutput = function (processIndex) {
|
||||
|
||||
/*
|
||||
Here we emit the events that signals that a Dataset was updated.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newLearningProcess = function (processIndex, logger, UTILITIES) {
|
||||
exports.newLearningProcess = function (processIndex, UTILITIES) {
|
||||
|
||||
|
||||
thisObject = {
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
|
||||
function initializeProcessExecutionEvents() {
|
||||
try {
|
||||
processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(processIndex, logger)
|
||||
processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(processIndex)
|
||||
processExecutionEvents.initialize(processConfig, onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
@@ -236,7 +236,7 @@
|
||||
|
||||
function initializeStatusDependencies() {
|
||||
try {
|
||||
statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(processIndex, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT);
|
||||
statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(processIndex, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT);
|
||||
statusDependencies.initialize(onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
@@ -284,7 +284,7 @@
|
||||
|
||||
function initializeUserBot() {
|
||||
try {
|
||||
usertBot = USER_BOT_MODULE.newUserBot(processIndex, logger, COMMONS_MODULE, UTILITIES, FILE_STORAGE, STATUS_REPORT, exchangeAPI);
|
||||
usertBot = USER_BOT_MODULE.newUserBot(processIndex, COMMONS_MODULE, UTILITIES, FILE_STORAGE, STATUS_REPORT, exchangeAPI);
|
||||
usertBot.initialize(statusDependencies, onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newSocialBots = function (processIndex, logger) {
|
||||
exports.newSocialBots = function (processIndex) {
|
||||
|
||||
const MODULE_NAME = 'Social Bots'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newStatusDependencies = function (processIndex, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT) {
|
||||
exports.newStatusDependencies = function (processIndex, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT) {
|
||||
|
||||
const MODULE_NAME = "Status Dependencies";
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
for (let i = 0; i < dependenciesToProcess.length; i++) {
|
||||
|
||||
let statusReportModule = STATUS_REPORT.newStatusReport(processIndex, logger, UTILITIES, PROCESS_OUTPUT);
|
||||
let statusReportModule = STATUS_REPORT.newStatusReport(processIndex, UTILITIES, PROCESS_OUTPUT);
|
||||
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE.write(MODULE_NAME, "[INFO] initialize -> onInitilized -> Initializing Status Report # " + (i + 1));
|
||||
let statusDependency = dependenciesToProcess[i]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newStatusReport = function (processIndex, logger, UTILITIES, PROCESS_OUTPUT) {
|
||||
exports.newStatusReport = function (processIndex, UTILITIES, PROCESS_OUTPUT) {
|
||||
|
||||
/*
|
||||
|
||||
@@ -365,7 +365,7 @@
|
||||
|
||||
/* All good, lets emit the event that means data has been updated. */
|
||||
|
||||
let processOutput = PROCESS_OUTPUT.newProcessOutput(processIndex, logger)
|
||||
let processOutput = PROCESS_OUTPUT.newProcessOutput(processIndex)
|
||||
processOutput.raiseEvents(thisObject.file.lastFile, thisObject.file.timeFrames, callBackFunction);
|
||||
return
|
||||
}
|
||||
@@ -392,7 +392,7 @@
|
||||
}
|
||||
|
||||
/* All good, lets emit the event that means data has been updated. */
|
||||
let processOutput = PROCESS_OUTPUT.newProcessOutput(processIndex, logger)
|
||||
let processOutput = PROCESS_OUTPUT.newProcessOutput(processIndex)
|
||||
processOutput.asyncRaiseEvents(thisObject.file.lastFile, thisObject.file.timeFrames)
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@
|
||||
|
||||
function initializeProcessExecutionEvents() {
|
||||
try {
|
||||
processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(processIndex, logger)
|
||||
processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(processIndex)
|
||||
processExecutionEvents.initialize(processConfig, onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
@@ -220,7 +220,7 @@
|
||||
|
||||
function initializeStatusDependencies() {
|
||||
try {
|
||||
statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(processIndex, logger, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT);
|
||||
statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(processIndex, STATUS_REPORT, UTILITIES, PROCESS_OUTPUT);
|
||||
statusDependencies.initialize(onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
@@ -268,7 +268,7 @@
|
||||
|
||||
function initializeDataDependencies() {
|
||||
try {
|
||||
dataDependencies = DATA_DEPENDENCIES.newDataDependencies(processIndex, logger, DATA_SET);
|
||||
dataDependencies = DATA_DEPENDENCIES.newDataDependencies(processIndex, DATA_SET);
|
||||
dataDependencies.initialize(onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
@@ -278,7 +278,7 @@
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE.write(MODULE_NAME, "[INFO] run -> loop -> initializeDataDependencies -> onInizialized -> Execution finished well.")
|
||||
switch (processConfig.framework.name) {
|
||||
case 'Low-Frequency-Trading-Process': {
|
||||
processFramework = TRADING_PROCESS_MODULE.newTradingProcess(processIndex, logger, UTILITIES);
|
||||
processFramework = TRADING_PROCESS_MODULE.newTradingProcess(processIndex, UTILITIES);
|
||||
intitializeProcessFramework();
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user