Configuration Upgrade

This commit is contained in:
Luis Fernando Molina committed 2018-03-10 18:23:15 +01:00
1 parent 89007c6e34
commit fab5926309
7 files changed
+23 -19

No files matched your search

Binary file not shown.
+6 -6
View File
@@ -147,7 +147,7 @@
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getStatusReport -> Entering function."); }
let fileName = "Status.Report.json"
let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Processes/" + bot.process + "/" + global.EXCHANGE_NAME;
let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Processes/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor;
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getStatusReport -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getStatusReport -> filePath = " + filePath); }
@@ -205,7 +205,7 @@
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> Entering function."); }
let fileName = "Execution.History.json"
let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.EXCHANGE_NAME;
let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor;
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionHistory -> filePath = " + filePath); }
@@ -266,7 +266,7 @@
let fileName = "Execution.Context.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.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.EXCHANGE_NAME + "/" + dateForPath;
let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + dateForPath;
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionContext -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] initialize -> getExecutionContext -> filePath = " + filePath); }
@@ -426,7 +426,7 @@
let fileName = "Execution.Context.json"
let dateForPath = global.processDatetime.getUTCFullYear() + '/' + utilities.pad(global.processDatetime.getUTCMonth() + 1, 2) + '/' + utilities.pad(global.processDatetime.getUTCDate(), 2) + '/' + utilities.pad(global.processDatetime.getUTCHours(), 2) + '/' + utilities.pad(global.processDatetime.getUTCMinutes(), 2);
let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.EXCHANGE_NAME + "/" + dateForPath;
let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + dateForPath;
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExecutionContext -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExecutionContext -> filePath = " + filePath); }
@@ -486,7 +486,7 @@
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> Entering function."); }
let fileName = "Execution.History.json"
let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.EXCHANGE_NAME;
let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Output/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor;
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeExucutionHistory -> filePath = " + filePath); }
@@ -562,7 +562,7 @@
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeStatusReport -> Entering function."); }
let fileName = "Status.Report.json"
let filePath = bot.devTeam + "/" + bot.codeName + "/" + bot.dataSetVersion + "/Processes/" + bot.process + "/" + global.EXCHANGE_NAME;
let filePath = bot.devTeam + "/" + bot.codeName + "." + bot.version.major + "." + bot.version.minor + "/" + bot.dataSetVersion + "/Processes/" + bot.process + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor;
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeStatusReport -> fileName = " + fileName); }
if (FULL_LOG === true) { logger.write("[INFO] saveThemAll -> writeStatusReport -> filePath = " + filePath); }
+2 -2
View File
@@ -40,11 +40,11 @@
createFolderSync(folderPath);
folderPath = '../../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "/" + thisObject.bot.version;
folderPath = '../../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "." + thisObject.bot.version.major + "." + thisObject.bot.version.minor;
createFolderSync(folderPath);
folderPath = '../../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "/" + thisObject.bot.version + "/" + thisObject.bot.process;
folderPath = '../../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "." + thisObject.bot.version.major + "." + thisObject.bot.version.minor + "/" + thisObject.bot.process;
createFolderSync(folderPath);
+1 -1
View File
@@ -45,7 +45,7 @@
</ItemGroup>
<ItemGroup>
<Content Include=".gitignore" />
<Content Include="this.vm.config.json" />
<Content Include="platform.config.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<!--Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them.-->
+6 -7
View File
@@ -8,11 +8,10 @@ global.RUNNING_MODE = 'Production'; // 'Testnet' or 'Production'
/* First thing to do is to read the config and guess which bot we will be running. */
var fs = require('fs');
let vmConfig;
try {
vmConfig = JSON.parse(fs.readFileSync('this.vm.config.json', 'utf8'));
global.PLATFORM_CONFIG = JSON.parse(fs.readFileSync('platform.config.json', 'utf8'));
}
catch (err) {
@@ -28,7 +27,7 @@ let botConfig;
try {
botConfig = JSON.parse(fs.readFileSync(vmConfig.bot.path + '/this.bot.config.json', 'utf8'));
botConfig = JSON.parse(fs.readFileSync(global.PLATFORM_CONFIG.bot.path + '/this.bot.config.json', 'utf8'));
}
catch (err) {
console.log("[ERROR] 'readConfig' - ERROR : " + err.message);
@@ -167,7 +166,7 @@ for (let i = 0; i < botConfig.processes.length; i++) {
const newIntervalExecutor = INTERVAL_EXECUTOR_MODULE.newIntervalExecutor(bot);
newIntervalExecutor.initialize(vmConfig.bot.path, processConfig, year, month, onInitializeReady);
newIntervalExecutor.initialize(global.PLATFORM_CONFIG.bot.path, processConfig, year, month, onInitializeReady);
function onInitializeReady() {
@@ -192,7 +191,7 @@ for (let i = 0; i < botConfig.processes.length; i++) {
const newIntervalExecutor = INTERVAL_EXECUTOR_MODULE.newIntervalExecutor(bot);
newIntervalExecutor.initialize(vmConfig.bot.path, processConfig, processConfig.startMode.oneMonth.year, processConfig.startMode.oneMonth.month, onInitializeReady);
newIntervalExecutor.initialize(global.PLATFORM_CONFIG.bot.path, processConfig, processConfig.startMode.oneMonth.year, processConfig.startMode.oneMonth.month, onInitializeReady);
function onInitializeReady() {
@@ -218,7 +217,7 @@ for (let i = 0; i < botConfig.processes.length; i++) {
const newIntervalExecutor = INTERVAL_EXECUTOR_MODULE.newIntervalExecutor(bot);
newIntervalExecutor.initialize(vmConfig.bot.path, processConfig, undefined, undefined, onInitializeReady);
newIntervalExecutor.initialize(global.PLATFORM_CONFIG.bot.path, processConfig, undefined, undefined, onInitializeReady);
function onInitializeReady() {
@@ -243,7 +242,7 @@ function runTradingBot(pProcessConfig) {
if (FULL_LOG === true) { logger.write("[INFO] runTradingBot -> Entering function."); }
let tradingBotMainLoop = TRADING_BOT_MAIN_LOOP_MODULE.newTradingBotMainLoop(botConfig);
tradingBotMainLoop.initialize(vmConfig.bot.path, pProcessConfig, onInitializeReady);
tradingBotMainLoop.initialize(global.PLATFORM_CONFIG.bot.path, pProcessConfig, onInitializeReady);
function onInitializeReady(err) {
+2 -3
View File
@@ -352,12 +352,11 @@
function shallWeStop() {
var fs = require('fs');
let vmConfig;
try {
vmConfig = JSON.parse(fs.readFileSync('this.vm.config.json', 'utf8'));
return JSON.parse(vmConfig.stopGracefully);
global.PLATFORM_CONFIG = JSON.parse(fs.readFileSync('platform.config.json', 'utf8'));
return JSON.parse(global.PLATFORM_CONFIG.stopGracefully);
}
catch (err) {
const logText = "[ERROR] 'readConfig' - ERROR : " + err.message;
@@ -1,4 +1,10 @@
{
"codeName": "AACloudPlatform",
"version": {
"major": 1,
"minor": 0,
"patch": 0
},
"bot": {
"path": "../Bots/AAMasters/AAMariam-Trading-Bot"
},