Merge pull request #125 from AAMasters/develop

Trading Engine Sequenced
This commit is contained in:
benme authored and GitHub committed 2019-08-09 17:23:46 -03:00
commit 6c8e66093e
18 files changed
+4646 -482

No files matched your search

+8 -6
View File
@@ -102,7 +102,7 @@
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> getMarketRateFromExchange -> onTicker -> We could not get the Market Price now."); }
callBackFunction(err);
callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
}
@@ -653,11 +653,13 @@
let sumAssetA = 0;
let sumAssetB = 0;
let sumRate = 0;
for (let k = 0; k < pTrades.length; k++) {
let trade = pTrades[k];
sumAssetA = sumAssetA + thisObject.truncDecimals(trade.amountA);
sumAssetB = sumAssetB + thisObject.truncDecimals(trade.amountB);
sumRate = sumRate + thisObject.truncDecimals(trade.rate);
}
sumAssetA = thisObject.truncDecimals(sumAssetA);
@@ -683,9 +685,9 @@
position.status = "executed";
if (position.type === "sell") {
context.newHistoryRecord.sellExecRate = position.rate;
context.newHistoryRecord.sellExecRate = sumRate / pTrades.length;
} else {
context.newHistoryRecord.buyExecRate = position.rate;
context.newHistoryRecord.buyExecRate = sumRate / pTrades.length;
}
applyTradesToContext(pTrades);
@@ -942,7 +944,7 @@
let err = {
result: global.DEFAULT_FAIL_RESPONSE.result,
message: 'pAmountA is grater than the Available Balance.'
message: 'Not Enough Available Balance to Buy.'
};
callBackFunction(err);
@@ -960,7 +962,7 @@
let err = {
result: global.DEFAULT_FAIL_RESPONSE.result,
message: 'pAmountB is grater than the Available Balance.'
message: 'Not Enough Available Balance to Sell.'
};
callBackFunction(err);
@@ -1067,7 +1069,7 @@
break;
case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
logger.write(MODULE_NAME, "[ERROR] putPosition -> onResponse -> Operation Failed. Aborting the process.");
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
callBackFunction(err);
return;
}
break;
+2349
View File
File diff suppressed because it is too large. Load diff
+15 -10
View File
@@ -74,7 +74,7 @@
return thisObject;
function initialize(pStatusDependencies, pTotalAlgobots, callBackFunction) {
function initialize(pStatusDependencies, callBackFunction) {
try {
@@ -114,6 +114,7 @@
}
default: {
logger.write(MODULE_NAME, "[ERROR] initialize -> onDone -> Operation Failed with custom response.");
logger.write(MODULE_NAME, "[ERROR] initialize -> onDone -> err = " + JSON.stringify(err));
callBackFunction(err);
}
}
@@ -161,15 +162,15 @@
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> getExecutionHistory -> Entering function."); }
let fileName = "/Execution.History." + bot.startMode + "." + runIndex + ".json";
let filePath = bot.filePathRoot + "/Output/" + bot.process + fileName;
let fileName = "Execution.History." + bot.startMode + "." + runIndex + ".json";
let filePath = bot.filePathRoot + "/Output/Trading-Process/" + fileName;
fileStorage.getTextFile(global.DEV_TEAM, filePath, onFileReceived);
function onFileReceived(err, text) {
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
logger.write(MODULE_NAME, "[ERROR] initialize -> getExecutionHistory -> onFileReceived -> err = "+ err);
logger.write(MODULE_NAME, "[ERROR] initialize -> getExecutionHistory -> onFileReceived -> err = "+ JSON.stringify(err));
callBack(err);
return;
}
@@ -223,7 +224,7 @@
let fileName = "/Execution.Context." + bot.startMode + "." + runIndex + ".json";
let dateForPath = date.getUTCFullYear() + '/' + utilities.pad(date.getUTCMonth() + 1, 2) + '/' + utilities.pad(date.getUTCDate(), 2) + '/' + utilities.pad(date.getUTCHours(), 2) + '/' + utilities.pad(date.getUTCMinutes(), 2);
let filePath = bot.filePathRoot + "/Output/" + bot.process + '/' + dateForPath + fileName;
let filePath = bot.filePathRoot + "/Output/Trading-Process/" + dateForPath + fileName;
fileStorage.getTextFile(global.DEV_TEAM, filePath, onFileReceived);
@@ -302,9 +303,13 @@
runIndex = thisObject.statusReport.runs.length - 1;
thisObject.executionHistory = [];
if (process.env.INITIAL_BALANCE_ASSET_A === undefined || process.env.INITIAL_BALANCE_ASSET_B === undefined) { throw new Error("Environment Variables INITIAL_INVESTMENT_A and INITIAL_INVESTMENT_B cannot be undefined.") }
const INITIAL_INVESTMENT_A = Number(process.env.INITIAL_BALANCE_ASSET_A);
const INITIAL_INVESTMENT_B = Number(process.env.INITIAL_BALANCE_ASSET_B);
thisObject.executionContext = {
investment: { // This is used to calculate profits.
assetA: INITIAL_INVESTMENT_A,
@@ -393,7 +398,7 @@
let fileName = "/Execution.Context." + bot.startMode + "." + runIndex +".json";
let dateForPath = bot.processDatetime.getUTCFullYear() + '/' + utilities.pad(bot.processDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.processDatetime.getUTCDate(), 2) + '/' + utilities.pad(bot.processDatetime.getUTCHours(), 2) + '/' + utilities.pad(bot.processDatetime.getUTCMinutes(), 2);
let filePath = bot.filePathRoot + "/Output/" + bot.process + '/' + dateForPath + fileName;
let filePath = bot.filePathRoot + "/Output/Trading-Process/" + dateForPath + fileName;
let fileContent = JSON.stringify(thisObject.executionContext);
if(fileContent === undefined){
@@ -432,8 +437,8 @@
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] saveThemAll -> writeExucutionHistory -> Entering function."); }
let fileName = "/Execution.History." + bot.startMode + "." + runIndex + ".json";
let filePath = bot.filePathRoot + "/Output/" + bot.process + fileName;
let fileName = "Execution.History." + bot.startMode + "." + runIndex + ".json";
let filePath = bot.filePathRoot + "/Output/Trading-Process/" + fileName;
let newRecord = [
thisObject.newHistoryRecord.date.valueOf(),
@@ -483,8 +488,8 @@
/* Here we will write the file containing the max sequence number. */
fileContent = runIndex;
fileName = "/Execution.History." + bot.startMode + "." + "Sequence" + ".json";
filePath = bot.filePathRoot + "/Output/" + bot.process + fileName;
fileName = "Execution.History." + bot.startMode + "." + "Sequence" + ".json";
filePath = bot.filePathRoot + "/Output/Trading-Process/" + fileName;
fileStorage.createTextFile(global.DEV_TEAM, filePath, fileContent + '\n', onSequenceFileCreated);
+2 -2
View File
@@ -433,7 +433,7 @@
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> startUserBot -> Entering function."); }
usertBot.start(onFinished);
usertBot.start(onFinished);
function onFinished(err) {
@@ -563,7 +563,7 @@
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> intitializeProcessFramework -> Entering function."); }
processFramework.initialize(processConfig, statusDependencies, dataDependencies, onInizialized, dataDependencies);
processFramework.initialize(processConfig, statusDependencies, dataDependencies, undefined, onInizialized);
function onInizialized(err) {
+1 -1
View File
@@ -74,7 +74,7 @@ exports.getEcosystem = async function () {
global.ECOSYSTEM = ecosystemResponse.data.data.web_GetEcosystem
} else {
let fileLocation = process.env.CONFIG_PATH + 'ecosystem.json'
let fileLocation = process.env.INTER_PROCESS_FILES_PATH + '/ecosystem.json'
let ecosystem = await readFileAsync(fileLocation, { encoding: 'utf8' })
global.ECOSYSTEM = JSON.parse(ecosystem)
}
+5 -2
View File
@@ -45,13 +45,16 @@ exports.newFileStorage = function newFileStorage() {
}
async function getTextFile(container, filePath, callBackFunction) {
logInfo('getTextFile: ' + container.toLowerCase() + '/...' + filePath.substring(filePath.length - 110, filePath.length))
try {
let host = await getDevTeamHost(container)
if (host.url.indexOf('localhost') !== -1) {
let fileLocation = process.env.STORAGE_PATH + '/' + container + '/' + filePath
let fileLocation = process.env.STORAGE_PATH + '/' + container + '/' + filePath
logInfo('getTextFile: ' + fileLocation)
let fileContent = await readFileAsync(fileLocation)
callBackFunction(global.DEFAULT_OK_RESPONSE, fileContent.toString())
} else {
+34 -34
View File
@@ -1,51 +1,51 @@
const axios = require('axios')
let fs = require('fs')
const { promisify } = require('util')
const readFileAsync = promisify(fs.readFile);
const readFileAsync = promisify(fs.readFile)
exports.getStrategy = async function () {
try {
if (!global.STRATEGY) {
let executionOnCloud = false
if (process.env.ON_CLOUD !== undefined) {
executionOnCloud = JSON.parse(process.env.ON_CLOUD)
}
try {
if (!global.STRATEGY) {
let executionOnCloud = false
if (process.env.ON_CLOUD !== undefined) {
executionOnCloud = JSON.parse(process.env.ON_CLOUD)
}
if (executionOnCloud) {
const strategizerResponse = await axios({
url: process.env.GATEWAY_ENDPOINT_K8S,
method: 'post',
data: {
query: `
if (executionOnCloud) {
const strategizerResponse = await axios({
url: process.env.GATEWAY_ENDPOINT_K8S,
method: 'post',
data: {
query: `
query($fbSlug: String!){
strategizer_TradingSystemByFb(fbSlug: $fbSlug){
data
}
}
`,
variables: {
fbSlug: process.env.BOT
},
},
headers: {
authorization: process.env.AUTHORIZATION
}
})
if (strategizerResponse.data.errors)
throw new Error(strategizerResponse.data.errors[0].message)
global.STRATEGY = strategizerResponse.data.data.strategizer_TradingSystemByFb.data;
} else {
let fileLocation = process.env.CONFIG_PATH + 'userConfig.json'
let userConfig = await readFileAsync(fileLocation, { encoding: 'utf8' })
global.STRATEGY = JSON.parse(userConfig).strategy
variables: {
fbSlug: process.env.BOT
}
},
headers: {
authorization: process.env.AUTHORIZATION
}
})
if (strategizerResponse.data.errors) {
throw new Error(strategizerResponse.data.errors[0].message)
}
return global.STRATEGY
} catch (error) {
throw new Error('There has been an error getting the strategy: ', JSON.stringify(error))
global.STRATEGY = strategizerResponse.data.data.strategizer_TradingSystemByFb.data
} else {
let fileLocation = process.env.INTER_PROCESS_FILES_PATH + '/definition.json'
let strategy = await readFileAsync(fileLocation, { encoding: 'utf8' })
global.STRATEGY = JSON.parse(strategy)
}
}
return global.STRATEGY
} catch (error) {
throw new Error('There has been an error getting the strategy: ', JSON.stringify(error))
}
}
+13 -13
View File
@@ -27,7 +27,7 @@
return thisObject;
function initialize(pProcessConfig, pStatusDependencies, pDataDependencies, callBackFunction) {
function initialize(pProcessConfig, pStatusDependencies, pDataDependencies, pAssistant, callBackFunction) {
try {
@@ -59,7 +59,7 @@
}
usertBot = USER_BOT_MODULE.newUserBot(bot, logger, COMMONS_MODULE, UTILITIES, fileStorage);
usertBot.initialize(dataDependencies, callBackFunction);
usertBot.initialize(dataDependencies, callBackFunction, pAssistant);
} catch (err) {
logger.write(MODULE_NAME, "[ERROR] initialize -> err = " + err);
@@ -284,7 +284,7 @@
let n;
let botNeverRan = true;
bot.processDatetime = new Date(contextVariables.lastFile.valueOf() - ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop.
bot.multiPeriodDailyProcessDatetime = new Date(contextVariables.lastFile.valueOf() - ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop.
advanceTime();
@@ -294,21 +294,21 @@
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> advanceTime -> Entering function."); }
bot.processDatetime = new Date(bot.processDatetime.valueOf() + ONE_DAY_IN_MILISECONDS);
previousDay = new Date(bot.processDatetime.valueOf() - ONE_DAY_IN_MILISECONDS);
bot.multiPeriodDailyProcessDatetime = new Date(bot.multiPeriodDailyProcessDatetime.valueOf() + ONE_DAY_IN_MILISECONDS);
previousDay = new Date(bot.multiPeriodDailyProcessDatetime.valueOf() - ONE_DAY_IN_MILISECONDS);
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " " + " bot.processDatetime = " + bot.processDatetime.toISOString());
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " " + " bot.multiPeriodDailyProcessDatetime = " + bot.multiPeriodDailyProcessDatetime.toISOString());
if (global.FULL_LOG === 'true') {
logger.newInternalLoop(bot.codeName, bot.process);
}
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> advanceTime -> bot.processDatetime = " + bot.processDatetime); }
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> advanceTime -> bot.multiPeriodDailyProcessDatetime = " + bot.multiPeriodDailyProcessDatetime); }
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> advanceTime -> previousDay = " + previousDay); }
/* Validation that we are not going past the head of the market. */
if (bot.processDatetime.valueOf() > contextVariables.dateEndOfMarket.valueOf()) {
if (bot.multiPeriodDailyProcessDatetime.valueOf() > contextVariables.dateEndOfMarket.valueOf()) {
const logText = "Head of the market found @ " + previousDay.getUTCFullYear() + "/" + (previousDay.getUTCMonth() + 1) + "/" + previousDay.getUTCDate() + ".";
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> advanceTime -> " + logText); }
@@ -395,7 +395,7 @@
let previousFile;
let currentFile;
if (bot.processDatetime.valueOf() > contextVariables.dateBeginOfMarket.valueOf()) {
if (bot.multiPeriodDailyProcessDatetime.valueOf() > contextVariables.dateBeginOfMarket.valueOf()) {
getPreviousFile();
} else {
previousFile = [];
@@ -473,7 +473,7 @@
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> periodsLoopBody -> dependencyLoopBody -> getCurrentFile -> Entering function."); }
let dateForPath = bot.processDatetime.getUTCFullYear() + '/' + utilities.pad(bot.processDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.processDatetime.getUTCDate(), 2);
let dateForPath = bot.multiPeriodDailyProcessDatetime.getUTCFullYear() + '/' + utilities.pad(bot.multiPeriodDailyProcessDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(bot.multiPeriodDailyProcessDatetime.getUTCDate(), 2);
let filePath = dependency.product + '/' + "Multi-Period-Daily" + "/" + outputPeriodLabel + "/" + dateForPath;
let fileName = market.assetA + '_' + market.assetB + ".json";
@@ -563,7 +563,7 @@
dataFiles,
timePeriod,
outputPeriodLabel,
bot.processDatetime,
bot.multiPeriodDailyProcessDatetime,
contextVariables.dateBeginOfMarket,
contextVariables.dateEndOfMarket,
interExecutionMemoryArray[n],
@@ -632,7 +632,7 @@
return;
}
writeStatusReport(bot.processDatetime, advanceTime);
writeStatusReport(bot.multiPeriodDailyProcessDatetime, advanceTime);
} catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> processTimePeriods -> controlLoop -> onWritten -> err = " + err);
@@ -667,7 +667,7 @@
let folderName = bot.products[productIndex].codeName;
writeDataRange(contextVariables.dateBeginOfMarket, bot.processDatetime, folderName, controlLoop);
writeDataRange(contextVariables.dateBeginOfMarket, bot.multiPeriodDailyProcessDatetime, folderName, controlLoop);
}
function controlLoop() {
+2 -2
View File
@@ -23,7 +23,7 @@
return thisObject;
function initialize(pProcessConfig, pStatusDependencies, pDataDependencies, callBackFunction) {
function initialize(pProcessConfig, pStatusDependencies, pDataDependencies, pAssistant, callBackFunction) {
try {
@@ -55,7 +55,7 @@
}
usertBot = USER_BOT_MODULE.newUserBot(bot, logger, COMMONS_MODULE, UTILITIES, fileStorage);
usertBot.initialize(dataDependencies, callBackFunction);
usertBot.initialize(dataDependencies, callBackFunction, pAssistant);
} catch (err) {
logger.write(MODULE_NAME, "[ERROR] initialize -> err = ", err);
+7 -21
View File
@@ -24,32 +24,20 @@
<Compile Include="Assistant.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="AzureStorage.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="BlobStorage.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="CloudRequire.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="Commons.js" />
<Compile Include="Integrations\Ecosystem.js" />
<Compile Include="Integrations\FileStorage.js" />
<Compile Include="Integrations\Strategy.js" />
<Compile Include="MinioBlobStorage.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="MultiPeriodDaily.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="MultiPeriodMarket.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="AzureBlobStorage.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="utils\auth.js">
<Compile Include="TradingEngineProcessMainLoop.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="User.Bot.js" />
<Compile Include="utils\logger.js">
<SubType>Code</SubType>
</Compile>
@@ -59,9 +47,6 @@
<Compile Include="DataSet.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="Integrations\OperationsModuleIntegration.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="Root.js">
<SubType>Code</SubType>
</Compile>
@@ -82,15 +67,16 @@
<Compile Include="StatusReport.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="StorageAccessManager.js" />
<Compile Include="TradingBotProcessMainLoop.js">
<SubType>Code</SubType>
</Compile>
<Compile Include="CloudUtilities.js" />
</ItemGroup>
<ItemGroup>
<Content Include=".env" />
<Content Include=".gitignore" />
<Content Include="this.config.json" />
<Content Include="sequence - all processes.json" />
<Content Include="sequence.json" />
</ItemGroup>
<ItemGroup>
<Folder Include="Integrations\" />
+88 -9
View File
@@ -149,6 +149,7 @@
const TRADING_BOT_MAIN_LOOP_MODULE = require('./TradingBotProcessMainLoop');
const INDICATOR_BOT_MAIN_LOOP_MODULE = require('./IndicatorBotProcessMainLoop');
const EXTRACTION_BOT_MAIN_LOOP_MODULE = require('./SensorBotProcessMainLoop');
const TRADING_ENGINE_MAIN_LOOP_MODULE = require('./TradingEngineProcessMainLoop');
/* Loop through all the processes configured to be run by this Node.js Instance. */
@@ -175,7 +176,7 @@
function onFileReceived(err, text) {
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
console.log(logDisplace + "Root : [ERROR] start -> getBotConfig -> onInizialized -> onFileReceived -> err = "+ err);
console.log(logDisplace + "Root : [ERROR] start -> getBotConfig -> onInizialized -> onFileReceived -> err = " + JSON.stringify(err));
return;
}
@@ -185,7 +186,7 @@
botConfig.repo = cloneToExecute.repo;
findProcess();
} catch (err) {
console.log(logDisplace + "Root : [ERROR] start -> getBotConfig -> onInizialized -> onFileReceived -> err = "+ err);
console.log(logDisplace + "Root : [ERROR] start -> getBotConfig -> onInizialized -> onFileReceived -> err = " + JSON.stringify(err));
return;
}
}
@@ -235,13 +236,19 @@
// TODO Pending. Move this if inside IndicatorBotProcessMainLoop line 270
if (processConfig.framework !== undefined) {
if (processConfig.framework.name === "Multi-Period-Daily" || processConfig.framework.name === "Multi-Period-Market") {
if (processConfig.startMode.noTime.beginDatetime !== undefined) {
processConfig.framework.startDate.fixedDate = processConfig.startMode.noTime.beginDatetime;
processConfig.framework.startDate.resumeExecution = false;
}else{
processConfig.framework.startDate.resumeExecution = true;
processConfig.framework.startDate.resumeExecution = false;
if (processConfig.startMode.noTime !== undefined) {
if (processConfig.startMode.noTime.beginDatetime !== undefined) {
processConfig.framework.startDate.fixedDate = processConfig.startMode.noTime.beginDatetime;
processConfig.framework.startDate.resumeExecution = false;
}
}
if (processConfig.startMode.live !== undefined) {
if (processConfig.startMode.live.beginDatetime !== undefined) {
processConfig.framework.startDate.fixedDate = processConfig.startMode.live.beginDatetime;
processConfig.framework.startDate.resumeExecution = false;
}
}
}
}
@@ -353,6 +360,10 @@
runIndicatorBot(botConfig, processConfig, month, year);
break;
}
case 'Trading-Engine': {
runTradingEngine(botConfig, processConfig);
break;
}
default: {
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> Unexpected bot type. -> botConfig.type = " + botConfig.type);
}
@@ -403,6 +414,10 @@
runTradingBot(botConfig, processConfig);
break;
}
case 'Trading-Engine': {
runTradingEngine(botConfig, processConfig);
break;
}
default: {
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> Unexpected bot type. -> botConfig.type = " + botConfig.type);
}
@@ -749,7 +764,7 @@
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
tradingBotMainLoop.run(pGenes, pTotalInstances, whenRunFinishes);
tradingBotMainLoop.run(pGenes, whenRunFinishes);
function whenRunFinishes(err) {
@@ -795,6 +810,70 @@
}
}
function runTradingEngine(pBotConfig, pProcessConfig) {
try {
const DEBUG_MODULE = require(ROOT_DIR + 'DebugLog');
let logger;
logger = DEBUG_MODULE.newDebugLog();
logger.bot = pBotConfig;
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runTradingEngine -> Entering function."); }
let tradingEngineMainLoop = TRADING_ENGINE_MAIN_LOOP_MODULE.newTradingEngineProcessMainLoop(pBotConfig, logger);
tradingEngineMainLoop.initialize(UI_COMMANDS, pProcessConfig, onInitializeReady);
function onInitializeReady(err) {
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
tradingEngineMainLoop.run(whenRunFinishes);
function whenRunFinishes(err) {
pBotConfig.loopCounter = 0;
let botId;
botId = pBotConfig.devTeam + "." + pBotConfig.codeName + "." + pBotConfig.process;
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runTradingEngine -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully.");
logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runTradingEngine -> onInitializeReady -> whenStartFinishes -> Bot Id = " + botId);
console.log(logDisplace + "Root : [INFO] start -> findProcess -> runTradingEngine -> onInitializeReady -> whenStartFinishes -> botId = " + botId);
console.log(logDisplace + "Root : [INFO] start -> findProcess -> runTradingEngine -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully.");
logger.persist();
} else {
logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runTradingEngine -> onInitializeReady -> whenStartFinishes -> err = ", err);
logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runTradingEngine -> onInitializeReady -> whenStartFinishes -> Execution will be stopped. ");
logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runTradingEngine -> onInitializeReady -> whenStartFinishes -> Bye.");
logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runTradingEngine -> onInitializeReady -> whenStartFinishes -> Bot Id = " + botId);
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runTradingEngine -> onInitializeReady -> whenStartFinishes -> Bot execution finished with errors. Please check the logs.");
logger.persist();
}
callback(err, pBotConfig.devTeam + "." + pBotConfig.codeName + "." + pBotConfig.process)
}
} else {
logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runTradingEngine -> onInitializeReady -> err = ", err);
logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runTradingEngine -> onInitializeReady -> Failed to initialize the bot. ");
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runTradingEngine -> onInitializeReady -> err = ", err);
logger.persist();
}
}
}
catch (err) {
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runTradingEngine -> err = ", err);
}
}
}
catch (err) {
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> err.message = " + err.message);
+113 -84
View File
@@ -1,42 +1,43 @@
require('dotenv').config();
require('dotenv').config()
const strategy = require('./Integrations/Strategy')
global.SHALL_BOT_STOP = false;
global.AT_BREAKPOINT = false; // This is used only when running at the browser.
global.FULL_LOG = process.env.FULL_LOG;
global.SHALL_BOT_STOP = false
global.AT_BREAKPOINT = false // This is used only when running at the browser.
global.FULL_LOG = process.env.FULL_LOG
/* Default parameters can be changed by the execution configuration */
global.EXCHANGE_NAME = process.env.EXCHANGE_NAME;
global.MARKET = { assetA: "USDT", assetB: "BTC" };
global.CLONE_EXECUTOR = { codeName: 'AACloud', version: '1.1' };
global.EXCHANGE_NAME = process.env.EXCHANGE_NAME
global.MARKET = { assetA: 'USDT', assetB: 'BTC' }
global.CLONE_EXECUTOR = { codeName: 'AACloud', version: '1.1' }
process.on('uncaughtException', function (err) {
console.log('[INFO] Run -> uncaughtException -> err.message = ' + err.message);
console.log('[INFO] Run -> uncaughtException -> err.stack = ' + err.stack);
process.exit(1)
});
console.log('[INFO] Run -> uncaughtException -> err.message = ' + err.message)
console.log('[INFO] Run -> uncaughtException -> err.stack = ' + err.stack)
process.exit(1)
})
process.on('unhandledRejection', (reason, p) => {
console.log('[INFO] Run -> unhandledRejection -> reason = ' + JSON.stringify(reason));
console.log('[INFO] Run -> unhandledRejection -> p = ' + JSON.stringify(p));
process.exit(1)
});
console.log('[INFO] Run -> unhandledRejection -> reason = ' + JSON.stringify(reason))
console.log('[INFO] Run -> unhandledRejection -> p = ' + JSON.stringify(p))
process.exit(1)
})
process.on('exit', function (code) {
console.log('[INFO] Run -> process.on.exit -> About to exit -> code = ' + code);
});
console.log('[INFO] Run -> process.on.exit -> About to exit -> code = ' + code)
})
let sequenceList = require('./sequence');
let isRunSequence = false;
let sequenceStep = 0;
let processedSteps = new Map()
if (process.env.RUN_SEQUENCE !== undefined) {
isRunSequence = JSON.parse(process.env.RUN_SEQUENCE)
isRunSequence = JSON.parse(process.env.RUN_SEQUENCE)
}
if (isRunSequence) {
sequenceExecution(sequenceStep);
sequenceExecution(sequenceStep)
} else {
readExecutionConfiguration();
readExecutionConfiguration()
}
function sequenceExecution(currentStep) {
@@ -72,10 +73,13 @@ function sequenceExecution(currentStep) {
sequenceStep++;
}
function onExecutionFinish(result, finishStepKey) {
processedSteps.set(finishStepKey, processedSteps.get(finishStepKey) + 1);
if (processedSteps.get(finishStepKey) > 1) {
console.log("[INFO] onExecutionFinish -> Step already processed.");
function onExecutionFinish (result, finishStepKey) {
processedSteps.set(finishStepKey, processedSteps.get(finishStepKey) + 1)
if (processedSteps.get(finishStepKey) > 1) {
console.log('[INFO] onExecutionFinish -> Step already processed.')
} else {
if (sequenceStep < sequenceList.length) {
sequenceExecution(sequenceStep)
} else {
if (sequenceStep < sequenceList.length) {
sequenceExecution(sequenceStep);
@@ -89,35 +93,61 @@ function onExecutionFinish(result, finishStepKey) {
}, process.env.EXECUTION_LOOP_DELAY);
}
}
}
}
function readExecutionConfiguration() {
async function readExecutionConfiguration() {
try {
console.log("[INFO] Run -> readExecutionConfiguration -> Entering function. ");
/* Try to get the begin and end dates from the Definition */
let definition = await strategy.getStrategy()
let initialDatetime = process.env.BEGIN_DATE_TIME
let finalDatetime = process.env.END_DATE_TIME
if (definition !== undefined) {
if (definition.tradingSystem !== undefined) {
if (definition.tradingSystem.parameters !== undefined) {
if (definition.tradingSystem.parameters.baseAsset !== undefined) {
if (definition.tradingSystem.parameters.baseAsset.formula !== undefined) {
if (definition.tradingSystem.parameters.baseAsset.formula.code !== undefined) {
let code = JSON.parse(definition.tradingSystem.parameters.baseAsset.formula.code)
initialDatetime = code.initialDatetime
finalDatetime = code.finalDatetime
}
}
}
}
}
}
let startMode
// General Financial Being Configuration
global.DEV_TEAM = process.env.DEV_TEAM
global.CURRENT_BOT_REPO = process.env.BOT + "-" + process.env.TYPE + "-Bot"
if (process.env.TYPE === 'Trading') {
if (process.env.TYPE === 'Trading' || process.env.TYPE === 'Trading-Engine') {
let live = {
run: "false",
resumeExecution: process.env.RESUME_EXECUTION
run: 'false',
resumeExecution: process.env.RESUME_EXECUTION,
beginDatetime: initialDatetime,
endDatetime: finalDatetime
}
let backtest = {
run: "false",
resumeExecution: process.env.RESUME_EXECUTION,
beginDatetime: process.env.BEGIN_DATE_TIME,
endDatetime: process.env.END_DATE_TIME
run: 'false',
resumeExecution: process.env.RESUME_EXECUTION,
beginDatetime: initialDatetime,
endDatetime: finalDatetime
}
let competition = {
run: "false",
resumeExecution: process.env.RESUME_EXECUTION,
beginDatetime: process.env.BEGIN_DATE_TIME,
endDatetime: process.env.END_DATE_TIME
run: 'false',
resumeExecution: process.env.RESUME_EXECUTION,
beginDatetime: initialDatetime,
endDatetime: finalDatetime
}
startMode = {
@@ -190,61 +220,60 @@ function readExecutionConfiguration() {
}
}
function getTimePeriod(timePeriod) {
if (timePeriod !== undefined) {
try {
let timePeriodMap = new Map()
timePeriodMap.set("24-hs", 86400000)
timePeriodMap.set("12-hs", 43200000)
timePeriodMap.set("08-hs", 28800000)
timePeriodMap.set("06-hs", 21600000)
timePeriodMap.set("04-hs", 14400000)
timePeriodMap.set("03-hs", 10800000)
timePeriodMap.set("02-hs", 7200000)
timePeriodMap.set("01-hs", 3600000)
timePeriodMap.set("45-min", 2700000)
timePeriodMap.set("40-min", 2400000)
timePeriodMap.set("30-min", 1800000)
timePeriodMap.set("20-min", 1200000)
timePeriodMap.set("15-min", 900000)
timePeriodMap.set("10-min", 600000)
timePeriodMap.set("05-min", 300000)
timePeriodMap.set("04-min", 240000)
timePeriodMap.set("03-min", 180000)
timePeriodMap.set("02-min", 120000)
timePeriodMap.set("01-min", 60000)
return timePeriodMap.get(timePeriod)
} catch (error) {
console.log("[WARN] Run -> readExecutionConfiguration -> getTimePeriod -> Error: ", error);
}
} else {
return undefined
function getTimePeriod (timePeriod) {
if (timePeriod !== undefined) {
try {
let timePeriodMap = new Map()
timePeriodMap.set('24-hs', 86400000)
timePeriodMap.set('12-hs', 43200000)
timePeriodMap.set('08-hs', 28800000)
timePeriodMap.set('06-hs', 21600000)
timePeriodMap.set('04-hs', 14400000)
timePeriodMap.set('03-hs', 10800000)
timePeriodMap.set('02-hs', 7200000)
timePeriodMap.set('01-hs', 3600000)
timePeriodMap.set('45-min', 2700000)
timePeriodMap.set('40-min', 2400000)
timePeriodMap.set('30-min', 1800000)
timePeriodMap.set('20-min', 1200000)
timePeriodMap.set('15-min', 900000)
timePeriodMap.set('10-min', 600000)
timePeriodMap.set('05-min', 300000)
timePeriodMap.set('04-min', 240000)
timePeriodMap.set('03-min', 180000)
timePeriodMap.set('02-min', 120000)
timePeriodMap.set('01-min', 60000)
return timePeriodMap.get(timePeriod)
} catch (error) {
console.log('[WARN] Run -> readExecutionConfiguration -> getTimePeriod -> Error: ', error)
}
} else {
return undefined
}
}
function startRoot() {
function startRoot () {
console.log('[INFO] Run -> startRoot -> Entering function. ')
console.log("[INFO] Run -> startRoot -> Entering function. ");
const ROOT_DIR = './'
const ROOT_MODULE = require(ROOT_DIR + 'Root')
let root = ROOT_MODULE.newRoot()
const ROOT_DIR = './';
const ROOT_MODULE = require(ROOT_DIR + 'Root');
let root = ROOT_MODULE.newRoot();
let UI_COMMANDS = {
beginDatetime: undefined,
endDatetime: undefined,
timePeriod: undefined,
startMode: undefined,
eventHandler: undefined
}
let UI_COMMANDS = {
beginDatetime: undefined,
endDatetime: undefined,
timePeriod: undefined,
startMode: undefined,
eventHandler: undefined
};
root.initialize(UI_COMMANDS, onInitialized)
root.initialize(UI_COMMANDS, onInitialized);
function onInitialized () {
console.log('[INFO] Run -> startRoot -> onInitialized -> Entering function. ')
function onInitialized() {
console.log("[INFO] Run -> startRoot -> onInitialized -> Entering function. ");
root.start(onExecutionFinish);
}
root.start(onExecutionFinish)
}
}
+2 -2
View File
@@ -77,7 +77,7 @@
}
}
function run(pGenes, pTotalAlgobots, callBackFunction) {
function run(pGenes, callBackFunction) {
let context;
@@ -436,7 +436,7 @@
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> initializeContext -> Entering function."); }
context = CONTEXT.newContext(bot, logger, UTILITIES);
context.initialize(statusDependencies, pTotalAlgobots, onInizialized);
context.initialize(statusDependencies, onInizialized);
function onInizialized(err) {
File diff suppressed because it is too large. Load diff
+556
View File
@@ -0,0 +1,556 @@
exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileStorage) {
const FULL_LOG = true;
const LOG_FILE_CONTENT = false;
const MODULE_NAME = "User Bot";
const EXECUTION_FOLDER_NAME = "Trading-Execution";
const SIMULATED_RECORDS_FOLDER_NAME = "Trading-Simulation";
const CONDITIONS_FOLDER_NAME = "Simulation-Conditions";
const STRATEGIES_FOLDER_NAME = "Simulation-Strategies";
const TRADES_FOLDER_NAME = "Simulation-Trades";
const commons = COMMONS.newCommons(bot, logger, UTILITIES);
thisObject = {
initialize: initialize,
start: start
};
let utilities = UTILITIES.newCloudUtilities(bot, logger);
let dataDependencies;
let assistant;
return thisObject;
function initialize(pDataDependencies, callBackFunction, pAssistant) {
try {
logger.fileName = MODULE_NAME;
logger.initialize();
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] initialize -> Entering function."); }
dataDependencies = pDataDependencies;
assistant = pAssistant;
callBackFunction(global.DEFAULT_OK_RESPONSE);
} catch (err) {
logger.write(MODULE_NAME, "[ERROR] initialize -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
function start(dataFiles, timePeriod, outputPeriodLabel, currentDay, startDate, endDate, interExecutionMemory, callBackFunction) {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> Entering function."); }
let market = global.MARKET;
let dataFile;
let recordsArray
let conditionsArray
let strategiesArray
let tradesArray
let lastObjectsArray
let tradingSystem = {};
commons.initializeData();
for (let i = 0; i < dataDependencies.config.length; i++) {
let dependency = dataDependencies.config[i];
dataFile = dataFiles[i];
switch (i) {
/*
case 0: {
commons.buildLRC(dataFile, callBackFunction);
break;
}*/
case 0: {
commons.buildPercentageBandwidthMap(dataFile, callBackFunction);
break;
}
case 1: {
commons.buildBollingerBandsMap(dataFile, callBackFunction);
break;
}
case 2: {
commons.buildBollingerChannelsArray(dataFile, callBackFunction);
break;
}
case 3: {
commons.buildBollingerSubChannelsArray(dataFile, callBackFunction);
break;
}
case 4: {
commons.buildCandles(dataFile, callBackFunction);
break;
}
}
}
commons.runSimulation(
timePeriod,
currentDay,
startDate,
endDate,
interExecutionMemory,
assistant,
writeFiles,
callBackFunction)
function writeFiles(pTradingSystem, pExecutionArray, pRecordsArray, pConditionsArray, pStrategiesArray, pTradesArray, pLastObjectsArray) {
tradingSystem = pTradingSystem
executionArray = pExecutionArray
recordsArray = pRecordsArray
conditionsArray = pConditionsArray
strategiesArray = pStrategiesArray
tradesArray = pTradesArray
lastObjectsArray = pLastObjectsArray
writeExecutionFile()
}
function writeExecutionFile() {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeExecutionFile -> Entering function."); }
let separator = "";
let fileRecordCounter = 0;
let fileContent = "";
for (let i = 0; i < executionArray.length; i++) {
let record = executionArray[i];
/* Will only add to the file the records of the current day */
if (record.begin < currentDay.valueOf()) { continue; }
fileContent = fileContent + separator + '[' +
record.begin + "," +
record.end + "," +
JSON.stringify(record.executionRecord) + "]";
if (separator === "") { separator = ","; }
fileRecordCounter++;
}
fileContent = "[" + fileContent + "]";
let dateForPath = currentDay.getUTCFullYear() + '/' + utilities.pad(currentDay.getUTCMonth() + 1, 2) + '/' + utilities.pad(currentDay.getUTCDate(), 2);
let fileName = '' + market.assetA + '_' + market.assetB + '.json';
let filePathRoot = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + global.CLONE_EXECUTOR.codeName + "." + global.CLONE_EXECUTOR.version + "/" + global.EXCHANGE_NAME + "/" + bot.dataSetVersion;
let filePath = filePathRoot + "/Output/" + EXECUTION_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel + "/" + dateForPath;
filePath += '/' + fileName
fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated);
function onFileCreated(err) {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeExecutionFile -> onFileCreated -> Entering function."); }
if (LOG_FILE_CONTENT === true) { logger.write(MODULE_NAME, "[INFO] start -> writeExecutionFile -> onFileCreated -> fileContent = " + fileContent); }
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
logger.write(MODULE_NAME, "[ERROR] start -> writeExecutionFile -> onFileCreated -> err = " + err.stack);
logger.write(MODULE_NAME, "[ERROR] start -> writeExecutionFile -> onFileCreated -> filePath = " + filePath);
logger.write(MODULE_NAME, "[ERROR] start -> writeExecutionFile -> onFileCreated -> market = " + market.assetA + "_" + market.assetB);
callBackFunction(err);
return;
}
writeRecordsFile();
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> writeExecutionFile -> onFileCreated -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> writeExecutionFile -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
function writeRecordsFile() {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeRecordsFile -> Entering function."); }
let separator = "";
let fileRecordCounter = 0;
let fileContent = "";
for (let i = 0; i < recordsArray.length; i++) {
let record = recordsArray[i];
/* Will only add to the file the records of the current day */
if (record.begin < currentDay.valueOf()) { continue; }
fileContent = fileContent + separator + '[' +
record.begin + "," +
record.end + "," +
record.type + "," +
record.marketRate + "," +
record.amount + "," +
record.balanceA + "," +
record.balanceB + "," +
record.profit + "," +
record.lastTradeProfitLoss + "," +
record.stopLoss + "," +
record.roundtrips + "," +
record.hits + "," +
record.fails + "," +
record.hitRatio + "," +
record.ROI + "," +
record.periods + "," +
record.days + "," +
record.anualizedRateOfReturn + "," +
record.positionRate + "," +
record.lastTradeROI + "," +
record.strategy + "," +
record.strategyStageNumber + "," +
record.takeProfit + "," +
record.stopLossPhase + "," +
record.takeProfitPhase + "," +
JSON.stringify(record.executionRecord) + "," +
record.positionSize + "," +
record.initialBalanceA + "," +
record.minimumBalanceA + "," +
record.maximumBalanceA + "," +
record.initialBalanceB + "," +
record.minimumBalanceB + "," +
record.maximumBalanceB + "," +
record.baseAsset + "]";
if (separator === "") { separator = ","; }
fileRecordCounter++;
}
fileContent = "[" + fileContent + "]";
let dateForPath = currentDay.getUTCFullYear() + '/' + utilities.pad(currentDay.getUTCMonth() + 1, 2) + '/' + utilities.pad(currentDay.getUTCDate(), 2);
let fileName = '' + market.assetA + '_' + market.assetB + '.json';
let filePathRoot = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + global.CLONE_EXECUTOR.codeName + "." + global.CLONE_EXECUTOR.version + "/" + global.EXCHANGE_NAME + "/" + bot.dataSetVersion;
let filePath = filePathRoot + "/Output/" + SIMULATED_RECORDS_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel + "/" + dateForPath;
filePath += '/' + fileName
fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated);
function onFileCreated(err) {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeRecordsFile -> onFileCreated -> Entering function."); }
if (LOG_FILE_CONTENT === true) { logger.write(MODULE_NAME, "[INFO] start -> writeRecordsFile -> onFileCreated -> fileContent = " + fileContent); }
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
logger.write(MODULE_NAME, "[ERROR] start -> writeRecordsFile -> onFileCreated -> err = " + err.stack);
logger.write(MODULE_NAME, "[ERROR] start -> writeRecordsFile -> onFileCreated -> filePath = " + filePath);
logger.write(MODULE_NAME, "[ERROR] start -> writeRecordsFile -> onFileCreated -> market = " + market.assetA + "_" + market.assetB);
callBackFunction(err);
return;
}
writeConditionsFile();
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> writeRecordsFile -> onFileCreated -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> writeRecordsFile -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
function writeConditionsFile() {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeConditionsFile -> Entering function."); }
let separator = "";
let fileRecordCounter = 0;
let fileContent = "";
for (let i = 0; i < conditionsArray.length; i++) {
let record = conditionsArray[i];
/* Will only add to the file the records of the current day */
if (record.begin < currentDay.valueOf()) { continue; }
let conditions = "";
let conditionsSeparator = "";
/* Will only add to the file the records of the current day */
if (record.begin < currentDay.valueOf()) { continue; }
for (let j = 0; j < record.length - 3; j++) {
conditions = conditions + conditionsSeparator + record[j];
if (conditionsSeparator === "") { conditionsSeparator = ","; }
}
conditions = conditions + conditionsSeparator + '[' + record[record.length - 3] + ']'; // The last item contains an Array of condition values.
conditions = conditions + conditionsSeparator + '[' + record[record.length - 2] + ']'; // The last item contains an Array of formulaErrors.
conditions = conditions + conditionsSeparator + '[' + record[record.length - 1] + ']'; // The last item contains an Array of formulaValues.
fileContent = fileContent + separator + '[' + conditions + ']';
if (separator === "") { separator = ","; }
fileRecordCounter++;
}
fileContent = "[" + 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';
let filePathRoot = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + global.CLONE_EXECUTOR.codeName + "." + global.CLONE_EXECUTOR.version + "/" + global.EXCHANGE_NAME + "/" + bot.dataSetVersion;
let filePath = filePathRoot + "/Output/" + CONDITIONS_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel + "/" + dateForPath;
filePath += '/' + fileName
fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated);
function onFileCreated(err) {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeConditionsFile -> onFileCreated -> Entering function."); }
if (LOG_FILE_CONTENT === true) { logger.write(MODULE_NAME, "[INFO] start -> writeConditionsFile -> onFileCreated -> fileContent = " + fileContent); }
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
logger.write(MODULE_NAME, "[ERROR] start -> writeConditionsFile -> onFileCreated -> err = " + err.stack);
logger.write(MODULE_NAME, "[ERROR] start -> writeConditionsFile -> onFileCreated -> filePath = " + filePath);
logger.write(MODULE_NAME, "[ERROR] start -> writeConditionsFile -> onFileCreated -> market = " + market.assetA + "_" + market.assetB);
callBackFunction(err);
return;
}
writeStrategiesFile();
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> writeConditionsFile -> onFileCreated -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> writeConditionsFile -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
function writeStrategiesFile() {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeStrategiesFile -> Entering function."); }
let separator = "";
let fileRecordCounter = 0;
let fileContent = "";
for (let i = 0; i < strategiesArray.length; i++) {
let record = strategiesArray[i];
/* Will only add to the file the records of the current day. In this case since objects can span more than one day, we add all of the objects that ends
at the current date. */
if (record.end < currentDay.valueOf()) { continue; }
fileContent = fileContent + separator + '[' +
record.begin + "," +
record.end + "," +
record.status + "," +
record.number + "," +
record.beginRate + "," +
record.endRate + "]";
if (separator === "") { separator = ","; }
fileRecordCounter++;
}
fileContent = "[" + fileContent + "]";
let dateForPath = currentDay.getUTCFullYear() + '/' + utilities.pad(currentDay.getUTCMonth() + 1, 2) + '/' + utilities.pad(currentDay.getUTCDate(), 2);
let fileName = '' + market.assetA + '_' + market.assetB + '.json';
let filePathRoot = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + global.CLONE_EXECUTOR.codeName + "." + global.CLONE_EXECUTOR.version + "/" + global.EXCHANGE_NAME + "/" + bot.dataSetVersion;
let filePath = filePathRoot + "/Output/" + STRATEGIES_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel + "/" + dateForPath;
filePath += '/' + fileName
fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated);
function onFileCreated(err) {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeStrategiesFile -> onFileCreated -> Entering function."); }
if (LOG_FILE_CONTENT === true) { logger.write(MODULE_NAME, "[INFO] start -> writeStrategiesFile -> onFileCreated -> fileContent = " + fileContent); }
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
logger.write(MODULE_NAME, "[ERROR] start -> writeStrategiesFile -> onFileCreated -> err = " + err.stack);
logger.write(MODULE_NAME, "[ERROR] start -> writeStrategiesFile -> onFileCreated -> filePath = " + filePath);
logger.write(MODULE_NAME, "[ERROR] start -> writeStrategiesFile -> onFileCreated -> market = " + market.assetA + "_" + market.assetB);
callBackFunction(err);
return;
}
writeTradesFile();
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> writeStrategiesFile -> onFileCreated -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> writeStrategiesFile -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
function writeTradesFile() {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeTradesFile -> Entering function."); }
let separator = "";
let fileRecordCounter = 0;
let fileContent = "";
for (let i = 0; i < tradesArray.length; i++) {
let record = tradesArray[i];
/* Will only add to the file the records of the current day. In this case since objects can span more than one day, we add all of the objects that ends
at the current date. */
if (record.end < currentDay.valueOf()) { continue; }
if (record.stopRate === undefined) { record.stopRate = 0}
fileContent = fileContent + separator + '[' +
record.begin + "," +
record.end + "," +
record.status + "," +
record.lastTradeROI + "," +
record.beginRate + "," +
record.endRate + "," +
record.exitType + "," +
record.stopRate + "]";
if (separator === "") { separator = ","; }
fileRecordCounter++;
}
fileContent = "[" + fileContent + "]";
let dateForPath = currentDay.getUTCFullYear() + '/' + utilities.pad(currentDay.getUTCMonth() + 1, 2) + '/' + utilities.pad(currentDay.getUTCDate(), 2);
let fileName = '' + market.assetA + '_' + market.assetB + '.json';
let filePathRoot = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + global.CLONE_EXECUTOR.codeName + "." + global.CLONE_EXECUTOR.version + "/" + global.EXCHANGE_NAME + "/" + bot.dataSetVersion;
let filePath = filePathRoot + "/Output/" + TRADES_FOLDER_NAME + "/" + "Multi-Period-Daily" + "/" + outputPeriodLabel + "/" + dateForPath;
filePath += '/' + fileName
fileStorage.createTextFile(bot.devTeam, filePath, fileContent + '\n', onFileCreated);
function onFileCreated(err) {
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeTradesFile -> onFileCreated -> Entering function."); }
if (LOG_FILE_CONTENT === true) { logger.write(MODULE_NAME, "[INFO] start -> writeTradesFile -> onFileCreated -> fileContent = " + fileContent); }
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
logger.write(MODULE_NAME, "[ERROR] start -> writeTradesFile -> onFileCreated -> err = " + err.stack);
logger.write(MODULE_NAME, "[ERROR] start -> writeTradesFile -> onFileCreated -> filePath = " + filePath);
logger.write(MODULE_NAME, "[ERROR] start -> writeTradesFile -> onFileCreated -> market = " + market.assetA + "_" + market.assetB);
callBackFunction(err);
return;
}
callBackFunction(global.DEFAULT_OK_RESPONSE);
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> writeTradesFile -> onFileCreated -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> writeTradesFile -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
}
catch (err) {
logger.write(MODULE_NAME, "[ERROR] start -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
};
+114 -114
View File
@@ -11,12 +11,12 @@
"requires": {
"axios": "0.19.0",
"dotenv": "8.0.0",
"nonce": "^1.0.4",
"querystring": "^0.2.0",
"request": "^2.88.0",
"retry": "^0.12.0",
"superagent": "^5.0.2",
"underscore": "^1.9.1"
"nonce": "1.0.4",
"querystring": "0.2.0",
"request": "2.88.0",
"retry": "0.12.0",
"superagent": "5.1.0",
"underscore": "1.9.1"
}
},
"@superalgos/mqservice": {
@@ -29,10 +29,10 @@
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
"integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
"requires": {
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
"fast-deep-equal": "2.0.1",
"fast-json-stable-stringify": "2.0.0",
"json-schema-traverse": "0.4.1",
"uri-js": "4.2.2"
}
},
"asn1": {
@@ -40,7 +40,7 @@
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
"integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
"requires": {
"safer-buffer": "~2.1.0"
"safer-buffer": "2.1.2"
}
},
"assert-plus": {
@@ -53,7 +53,7 @@
"resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz",
"integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==",
"requires": {
"lodash": "^4.17.11"
"lodash": "4.17.11"
}
},
"asynckit": {
@@ -77,7 +77,7 @@
"integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
"is-buffer": "2.0.3"
}
},
"bcrypt-pbkdf": {
@@ -85,7 +85,7 @@
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
"requires": {
"tweetnacl": "^0.14.3"
"tweetnacl": "0.14.5"
}
},
"caseless": {
@@ -98,8 +98,8 @@
"resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz",
"integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==",
"requires": {
"color-convert": "^1.9.1",
"color-string": "^1.5.2"
"color-convert": "1.9.3",
"color-string": "1.5.3"
}
},
"color-convert": {
@@ -120,8 +120,8 @@
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz",
"integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==",
"requires": {
"color-name": "^1.0.0",
"simple-swizzle": "^0.2.2"
"color-name": "1.1.3",
"simple-swizzle": "0.2.2"
}
},
"colornames": {
@@ -139,8 +139,8 @@
"resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.2.tgz",
"integrity": "sha512-vt+OoIP2d76xLhjwbBaucYlNSpPsrJWPlBTtwCpQKIu6/CSMutyzX93O/Do0qzpH3YoHEes8YEFXyZ797rEhzQ==",
"requires": {
"color": "3.0.x",
"text-hex": "1.0.x"
"color": "3.0.0",
"text-hex": "1.0.0"
}
},
"combined-stream": {
@@ -148,7 +148,7 @@
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": {
"delayed-stream": "~1.0.0"
"delayed-stream": "1.0.0"
}
},
"component-emitter": {
@@ -171,7 +171,7 @@
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
"requires": {
"assert-plus": "^1.0.0"
"assert-plus": "1.0.0"
}
},
"debug": {
@@ -192,9 +192,9 @@
"resolved": "https://registry.npmjs.org/diagnostics/-/diagnostics-1.1.1.tgz",
"integrity": "sha512-8wn1PmdunLJ9Tqbx+Fx/ZEuHfJf4NKSN2ZBj7SJC/OWRWha843+WsTjqMe1B5E3p28jqBlp+mJ2fPVxPyNgYKQ==",
"requires": {
"colorspace": "1.1.x",
"enabled": "1.0.x",
"kuler": "1.0.x"
"colorspace": "1.1.2",
"enabled": "1.0.2",
"kuler": "1.0.1"
}
},
"dotenv": {
@@ -207,8 +207,8 @@
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
"integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
"requires": {
"jsbn": "~0.1.0",
"safer-buffer": "^2.1.0"
"jsbn": "0.1.1",
"safer-buffer": "2.1.2"
}
},
"enabled": {
@@ -216,7 +216,7 @@
"resolved": "https://registry.npmjs.org/enabled/-/enabled-1.0.2.tgz",
"integrity": "sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M=",
"requires": {
"env-variable": "0.0.x"
"env-variable": "0.0.5"
}
},
"env-variable": {
@@ -259,7 +259,7 @@
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
"debug": "3.1.0"
}
},
"forever-agent": {
@@ -272,9 +272,9 @@
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
"asynckit": "0.4.0",
"combined-stream": "1.0.8",
"mime-types": "2.1.24"
}
},
"formidable": {
@@ -287,7 +287,7 @@
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
"requires": {
"assert-plus": "^1.0.0"
"assert-plus": "1.0.0"
}
},
"har-schema": {
@@ -300,8 +300,8 @@
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
"integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
"requires": {
"ajv": "^6.5.5",
"har-schema": "^2.0.0"
"ajv": "6.10.2",
"har-schema": "2.0.0"
}
},
"http-signature": {
@@ -309,9 +309,9 @@
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
"requires": {
"assert-plus": "^1.0.0",
"jsprim": "^1.2.2",
"sshpk": "^1.7.0"
"assert-plus": "1.0.0",
"jsprim": "1.4.1",
"sshpk": "1.16.1"
}
},
"is-arrayish": {
@@ -380,7 +380,7 @@
"resolved": "https://registry.npmjs.org/kuler/-/kuler-1.0.1.tgz",
"integrity": "sha512-J9nVUucG1p/skKul6DU3PUZrhs0LPulNaeUOox0IyXDi8S4CztTHs1gQphhuZmzXG7VOQSf6NJfKuzteQLv9gQ==",
"requires": {
"colornames": "^1.1.1"
"colornames": "1.1.1"
}
},
"lodash": {
@@ -393,11 +393,11 @@
"resolved": "https://registry.npmjs.org/logform/-/logform-2.1.2.tgz",
"integrity": "sha512-+lZh4OpERDBLqjiwDLpAWNQu6KMjnlXH2ByZwCuSqVPJletw0kTWJf5CgSNAUKn1KUkv3m2cUz/LK8zyEy7wzQ==",
"requires": {
"colors": "^1.2.1",
"fast-safe-stringify": "^2.0.4",
"fecha": "^2.3.3",
"ms": "^2.1.1",
"triple-beam": "^1.3.0"
"colors": "1.3.3",
"fast-safe-stringify": "2.0.6",
"fecha": "2.3.3",
"ms": "2.1.1",
"triple-beam": "1.3.0"
},
"dependencies": {
"ms": {
@@ -485,9 +485,9 @@
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz",
"integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==",
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
"inherits": "2.0.3",
"string_decoder": "1.2.0",
"util-deprecate": "1.0.2"
},
"dependencies": {
"inherits": {
@@ -502,26 +502,26 @@
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
"requires": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.6",
"extend": "~3.0.2",
"forever-agent": "~0.6.1",
"form-data": "~2.3.2",
"har-validator": "~5.1.0",
"http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.19",
"oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.2",
"safe-buffer": "^5.1.2",
"tough-cookie": "~2.4.3",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
"aws-sign2": "0.7.0",
"aws4": "1.8.0",
"caseless": "0.12.0",
"combined-stream": "1.0.8",
"extend": "3.0.2",
"forever-agent": "0.6.1",
"form-data": "2.3.3",
"har-validator": "5.1.3",
"http-signature": "1.2.0",
"is-typedarray": "1.0.0",
"isstream": "0.1.2",
"json-stringify-safe": "5.0.1",
"mime-types": "2.1.24",
"oauth-sign": "0.9.0",
"performance-now": "2.1.0",
"qs": "6.5.2",
"safe-buffer": "5.1.2",
"tough-cookie": "2.4.3",
"tunnel-agent": "0.6.0",
"uuid": "3.3.2"
}
},
"retry": {
@@ -549,7 +549,7 @@
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
"integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=",
"requires": {
"is-arrayish": "^0.3.1"
"is-arrayish": "0.3.2"
}
},
"sshpk": {
@@ -557,15 +557,15 @@
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
"integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
"requires": {
"asn1": "~0.2.3",
"assert-plus": "^1.0.0",
"bcrypt-pbkdf": "^1.0.0",
"dashdash": "^1.12.0",
"ecc-jsbn": "~0.1.1",
"getpass": "^0.1.1",
"jsbn": "~0.1.0",
"safer-buffer": "^2.0.2",
"tweetnacl": "~0.14.0"
"asn1": "0.2.4",
"assert-plus": "1.0.0",
"bcrypt-pbkdf": "1.0.2",
"dashdash": "1.14.1",
"ecc-jsbn": "0.1.2",
"getpass": "0.1.7",
"jsbn": "0.1.1",
"safer-buffer": "2.1.2",
"tweetnacl": "0.14.5"
}
},
"stack-trace": {
@@ -578,7 +578,7 @@
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz",
"integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==",
"requires": {
"safe-buffer": "~5.1.0"
"safe-buffer": "5.1.2"
}
},
"superagent": {
@@ -586,17 +586,17 @@
"resolved": "https://registry.npmjs.org/superagent/-/superagent-5.1.0.tgz",
"integrity": "sha512-7V6JVx5N+eTL1MMqRBX0v0bG04UjrjAvvZJTF/VDH/SH2GjSLqlrcYepFlpTrXpm37aSY6h3GGVWGxXl/98TKA==",
"requires": {
"component-emitter": "^1.3.0",
"cookiejar": "^2.1.2",
"debug": "^4.1.1",
"fast-safe-stringify": "^2.0.6",
"form-data": "^2.3.3",
"formidable": "^1.2.1",
"methods": "^1.1.2",
"mime": "^2.4.4",
"qs": "^6.7.0",
"readable-stream": "^3.4.0",
"semver": "^6.1.1"
"component-emitter": "1.3.0",
"cookiejar": "2.1.2",
"debug": "4.1.1",
"fast-safe-stringify": "2.0.6",
"form-data": "2.3.3",
"formidable": "1.2.1",
"methods": "1.1.2",
"mime": "2.4.4",
"qs": "6.7.0",
"readable-stream": "3.4.0",
"semver": "6.3.0"
},
"dependencies": {
"debug": {
@@ -604,7 +604,7 @@
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
"ms": "2.1.2"
}
},
"ms": {
@@ -629,8 +629,8 @@
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
"integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
"requires": {
"psl": "^1.1.24",
"punycode": "^1.4.1"
"psl": "1.2.0",
"punycode": "1.4.1"
},
"dependencies": {
"punycode": {
@@ -650,7 +650,7 @@
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"requires": {
"safe-buffer": "^5.0.1"
"safe-buffer": "5.1.2"
}
},
"tweetnacl": {
@@ -668,7 +668,7 @@
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
"requires": {
"punycode": "^2.1.0"
"punycode": "2.1.1"
}
},
"util-deprecate": {
@@ -686,9 +686,9 @@
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
"requires": {
"assert-plus": "^1.0.0",
"assert-plus": "1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "^1.2.0"
"extsprintf": "1.3.0"
}
},
"winston": {
@@ -696,15 +696,15 @@
"resolved": "https://registry.npmjs.org/winston/-/winston-3.2.1.tgz",
"integrity": "sha512-zU6vgnS9dAWCEKg/QYigd6cgMVVNwyTzKs81XZtTFuRwJOcDdBg7AU0mXVyNbs7O5RH2zdv+BdNZUlx7mXPuOw==",
"requires": {
"async": "^2.6.1",
"diagnostics": "^1.1.1",
"is-stream": "^1.1.0",
"logform": "^2.1.1",
"async": "2.6.2",
"diagnostics": "1.1.1",
"is-stream": "1.1.0",
"logform": "2.1.2",
"one-time": "0.0.4",
"readable-stream": "^3.1.1",
"stack-trace": "0.0.x",
"triple-beam": "^1.3.0",
"winston-transport": "^4.3.0"
"readable-stream": "3.4.0",
"stack-trace": "0.0.10",
"triple-beam": "1.3.0",
"winston-transport": "4.3.0"
}
},
"winston-transport": {
@@ -712,8 +712,8 @@
"resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.3.0.tgz",
"integrity": "sha512-B2wPuwUi3vhzn/51Uukcao4dIduEiPOcOt9HJ3QeaXgkJ5Z7UwpBzxS4ZGNHtrxrUvTwemsQiSys0ihOf8Mp1A==",
"requires": {
"readable-stream": "^2.3.6",
"triple-beam": "^1.2.0"
"readable-stream": "2.3.6",
"triple-beam": "1.3.0"
},
"dependencies": {
"inherits": {
@@ -726,13 +726,13 @@
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "1.0.0",
"process-nextick-args": "2.0.0",
"safe-buffer": "5.1.2",
"string_decoder": "1.1.1",
"util-deprecate": "1.0.2"
}
},
"string_decoder": {
@@ -740,7 +740,7 @@
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
"safe-buffer": "5.1.2"
}
}
}
+192
View File
@@ -0,0 +1,192 @@
[
{
"devTeam": "AAMasters",
"bot": "AACharly",
"mode": "noTime",
"resumeExecution": true,
"type": "Sensor",
"exchangeName": "Poloniex",
"process": "Live-Trades",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AACharly",
"mode": "noTime",
"resumeExecution": true,
"type": "Sensor",
"exchangeName": "Poloniex",
"process": "Hole-Fixing",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AABruce",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Single-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAOlivia",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAOlivia",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AATom",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AATom",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAChris",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAChris",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAPaula",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAPaula",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAJason",
"mode": "live",
"resumeExecution": true,
"type": "Trading-Engine",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"beginDatetime": "2019-08-01T08:00:00.000Z",
"timePeriod": "05-min"
},
{
"devTeam": "AAVikings",
"bot": "AAGauss",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAVikings",
"bot": "AAGauss",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "vikingsalerts",
"bot": "simulator-bot-vikingsalerts",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"beginDatetime": "2019-08-01T08:00:00.000Z",
"timePeriod": "05-min"
},
{
"devTeam": "vikingsalerts",
"bot": "bot-vikingsalerts",
"mode": "live",
"resumeExecution": true,
"type": "Trading",
"exchangeName": "Poloniex",
"process": "Trading-Process",
"beginDatetime": "2019-08-01T08:00:00.000Z",
"timePeriod": "05-min",
"dataSet": "Multi-Period-Daily"
}
]
+143 -182
View File
@@ -1,184 +1,145 @@
[
{
"devTeam": "AAMasters",
"bot": "AACharly",
"mode": "noTime",
"resumeExecution": true,
"type": "Sensor",
"exchangeName": "Poloniex",
"process": "Live-Trades",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AACharly",
"mode": "noTime",
"resumeExecution": true,
"type": "Sensor",
"exchangeName": "Poloniex",
"process": "Hole-Fixing",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AABruce",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Single-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAOlivia",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAOlivia",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AATom",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AATom",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAChris",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAChris",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAPaula",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAPaula",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAVikings",
"bot": "AAGauss",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAVikings",
"bot": "AAGauss",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "user",
"bot": "simulator-bot-user",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"beginDatetime": "2019-08-01T08:00:00.000Z",
"timePeriod": "05-min"
},
{
"devTeam": "user",
"bot": "bot-user",
"mode": "live",
"resumeExecution": true,
"type": "Trading",
"exchangeName": "Poloniex",
"process": "Trading-Process",
"beginDatetime": "2019-08-01T08:00:00.000Z",
"timePeriod": "05-min",
"dataSet": "Multi-Period-Daily",
"baseAsset": "assetB",
"balanceAssetA": 0,
"balanceAssetB": 0.001
}
{
"devTeam": "AAMasters",
"bot": "AACharly",
"mode": "noTime",
"resumeExecution": true,
"type": "Sensor",
"exchangeName": "Poloniex",
"process": "Live-Trades",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AACharly",
"mode": "noTime",
"resumeExecution": true,
"type": "Sensor",
"exchangeName": "Poloniex",
"process": "Hole-Fixing",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AABruce",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Single-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAOlivia",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAOlivia",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AATom",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AATom",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAChris",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAChris",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAPaula",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAPaula",
"mode": "noTime",
"resumeExecution": true,
"type": "Indicator",
"exchangeName": "Poloniex",
"process": "Multi-Period-Market",
"startYear": 2019,
"endYear": 2021,
"month": 1
},
{
"devTeam": "AAMasters",
"bot": "AAJason",
"mode": "live",
"resumeExecution": true,
"type": "Trading-Engine",
"exchangeName": "Poloniex",
"process": "Multi-Period-Daily",
"beginDatetime": "2019-08-01T08:00:00.000Z",
"timePeriod": "05-min"
}
]