Ready for debug
This commit is contained in:
1 parent
5276d86138
commit
9c1ada6fa6
4 files changed
+13
-176
No files matched your search
Binary file not shown.
+2
-2
@@ -28,7 +28,7 @@
|
||||
<Content Include="this.bot.config.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Candle-Stairs\" />
|
||||
<Folder Include="Candles-Volumes-Stairs-Market\" />
|
||||
<Folder Include="bin" />
|
||||
<Folder Include="logs" />
|
||||
<Folder Include="logs\AA Masters" />
|
||||
@@ -41,7 +41,7 @@
|
||||
<Folder Include="obj\Debug" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Candle-Stairs\Interval.js" />
|
||||
<Compile Include="Candles-Volumes-Stairs-Market\Interval.js" />
|
||||
</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.-->
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
let charlyAzureFileStorage = AZURE_FILE_STORAGE.newAzureFileStorage(bot);
|
||||
let bruceAzureFileStorage = AZURE_FILE_STORAGE.newAzureFileStorage(bot);
|
||||
let oliviaAzureFileStorage = AZURE_FILE_STORAGE.newAzureFileStorage(bot);
|
||||
let tomAzureFileStorage = AZURE_FILE_STORAGE.newAzureFileStorage(bot);
|
||||
|
||||
let utilities = UTILITIES.newUtilities(bot);
|
||||
|
||||
@@ -79,7 +80,7 @@
|
||||
|
||||
This process is going to do the following:
|
||||
|
||||
Read the candles and volumes from Bruce and produce a single Index File for each market with daily candles and volumes.
|
||||
Read the candles and volumes from Olivia and produce for each market two files with candles stairs and volumes stairs respectively.
|
||||
|
||||
*/
|
||||
|
||||
@@ -101,10 +102,6 @@ Read the candles and volumes from Bruce and produce a single Index File for each
|
||||
assetB: ""
|
||||
};
|
||||
|
||||
let lastCandleFile; // Datetime of the last file included on the Index File.
|
||||
let firstTradeFile; // Datetime of the first trade file in the whole market history.
|
||||
let maxCandleFile; // Datetime of the last file available to be included in the Index File.
|
||||
|
||||
let periods =
|
||||
'[' +
|
||||
'[' + 24 * 60 * 60 * 1000 + ',' + '"24-hs"' + ']' + ',' +
|
||||
@@ -208,7 +205,7 @@ Read the candles and volumes from Bruce and produce a single Index File for each
|
||||
|
||||
if (market.status === markets.ENABLED) {
|
||||
|
||||
getStatusReport();
|
||||
buildStairs();
|
||||
|
||||
} else {
|
||||
|
||||
@@ -217,8 +214,6 @@ Read the candles and volumes from Bruce and produce a single Index File for each
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (err) {
|
||||
const logText = "[ERROR] 'openMarket' - ERROR : " + err.message;
|
||||
@@ -250,145 +245,6 @@ Read the candles and volumes from Bruce and produce a single Index File for each
|
||||
|
||||
*/
|
||||
|
||||
function getStatusReport() {
|
||||
|
||||
try {
|
||||
|
||||
let reportFilePath;
|
||||
let fileName = "Status.Report." + market.assetA + '_' + market.assetB + ".json"
|
||||
|
||||
getHistoricTrades();
|
||||
|
||||
function getHistoricTrades() {
|
||||
|
||||
/*
|
||||
|
||||
We need to know where is the begining of the market, since that will help us know where the Index Files should start.
|
||||
|
||||
*/
|
||||
|
||||
reportFilePath = EXCHANGE_NAME + "/Processes/" + "Poloniex-Historic-Trades";
|
||||
|
||||
charlyAzureFileStorage.getTextFile(reportFilePath, fileName, onStatusReportReceived, true);
|
||||
|
||||
function onStatusReportReceived(text) {
|
||||
|
||||
let statusReport;
|
||||
|
||||
try {
|
||||
|
||||
statusReport = JSON.parse(text);
|
||||
|
||||
firstTradeFile = new Date(statusReport.lastFile.year + "-" + statusReport.lastFile.month + "-" + statusReport.lastFile.days + " " + statusReport.lastFile.hours + ":" + statusReport.lastFile.minutes + GMT_SECONDS);
|
||||
|
||||
getOneMinDailyCandlesVolumes();
|
||||
|
||||
} catch (err) {
|
||||
|
||||
const logText = "[INFO] 'getStatusReport' - Failed to read main Historic Trades Status Report for market " + market.assetA + '_' + market.assetB + " . Skipping it. ";
|
||||
logger.write(logText);
|
||||
|
||||
closeAndOpenMarket();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getOneMinDailyCandlesVolumes() {
|
||||
|
||||
/* We need to discover the maxCandle file, which is the last file with candles we can use as input. */
|
||||
|
||||
let date = new Date();
|
||||
let currentYear = date.getUTCFullYear();
|
||||
let currentMonth = utilities.pad(date.getUTCMonth() + 1,2);
|
||||
|
||||
reportFilePath = EXCHANGE_NAME + "/Processes/" + "One-Min-Daily-Candles-Volumes" + "/" + currentYear + "/" + currentMonth;
|
||||
|
||||
bruceAzureFileStorage.getTextFile(reportFilePath, fileName, onStatusReportReceived, true);
|
||||
|
||||
function onStatusReportReceived(text) {
|
||||
|
||||
let statusReport;
|
||||
|
||||
try {
|
||||
|
||||
statusReport = JSON.parse(text);
|
||||
|
||||
maxCandleFile = new Date(statusReport.lastFile.year + "-" + statusReport.lastFile.month + "-" + statusReport.lastFile.days + " " + "00:00" + GMT_SECONDS);
|
||||
|
||||
getThisProcessReport();
|
||||
|
||||
} catch (err) {
|
||||
|
||||
/*
|
||||
|
||||
It might happen that the file content is corrupt or it does not exist. In either case we will point our lastCandleFile
|
||||
to the last day of the previous month.
|
||||
|
||||
*/
|
||||
|
||||
maxCandleFile = new Date(date.valueOf() - ONE_DAY_IN_MILISECONDS);
|
||||
getThisProcessReport();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getThisProcessReport() {
|
||||
|
||||
/* If the process run and was interrupted, there should be a status report that allows us to resume execution. */
|
||||
|
||||
reportFilePath = EXCHANGE_NAME + "/Processes/" + bot.process;
|
||||
|
||||
oliviaAzureFileStorage.getTextFile(reportFilePath, fileName, onStatusReportReceived, true);
|
||||
|
||||
function onStatusReportReceived(text) {
|
||||
|
||||
let statusReport;
|
||||
|
||||
try {
|
||||
|
||||
statusReport = JSON.parse(text);
|
||||
|
||||
lastCandleFile = new Date(statusReport.lastFile.year + "-" + statusReport.lastFile.month + "-" + statusReport.lastFile.days + " " + "00:00" + GMT_SECONDS);
|
||||
|
||||
/*
|
||||
|
||||
Here we assume that the last day written might contain incomplete information. This actually happens every time the head of the market is reached.
|
||||
For that reason we go back one day, the partial information is discarded and added again with whatever new info is available.
|
||||
|
||||
*/
|
||||
|
||||
lastCandleFile = new Date(lastCandleFile.valueOf() - ONE_DAY_IN_MILISECONDS);
|
||||
|
||||
findPreviousContent();
|
||||
|
||||
} catch (err) {
|
||||
|
||||
/*
|
||||
|
||||
It might happen that the file content is corrupt or it does not exist. In either case we will point our lastCandleFile
|
||||
to the begining of the market.
|
||||
|
||||
*/
|
||||
|
||||
lastCandleFile = new Date(firstTradeFile.getUTCFullYear() + "-" + (firstTradeFile.getUTCMonth() + 1) + "-" + firstTradeFile.getUTCDate() + " " + "00:00" + GMT_SECONDS);
|
||||
|
||||
lastCandleFile = new Date(lastCandleFile.valueOf() - ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
|
||||
|
||||
buildCandles();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (err) {
|
||||
const logText = "[ERROR] 'getStatusReport' - ERROR : " + err.message;
|
||||
logger.write(logText);
|
||||
closeMarket();
|
||||
}
|
||||
}
|
||||
|
||||
function buildStairs() {
|
||||
|
||||
periodsLoop();
|
||||
@@ -964,14 +820,14 @@ Read the candles and volumes from Bruce and produce a single Index File for each
|
||||
|
||||
} else {
|
||||
|
||||
writeStatusReport(lastCandleFile, advanceTime);
|
||||
writeStatusReport();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function writeStatusReport(lastFileDate, callBack) {
|
||||
function writeStatusReport() {
|
||||
|
||||
if (LOG_INFO === true) {
|
||||
logger.write("[INFO] Entering function 'writeStatusReport'");
|
||||
@@ -981,12 +837,14 @@ Read the candles and volumes from Bruce and produce a single Index File for each
|
||||
|
||||
let reportFilePath = EXCHANGE_NAME + "/Processes/" + bot.process;
|
||||
|
||||
utilities.createFolderIfNeeded(reportFilePath, oliviaAzureFileStorage, onFolderCreated);
|
||||
utilities.createFolderIfNeeded(reportFilePath, tomAzureFileStorage, onFolderCreated);
|
||||
|
||||
function onFolderCreated() {
|
||||
|
||||
try {
|
||||
|
||||
let lastFileDate = new Date();
|
||||
|
||||
let fileName = "Status.Report." + market.assetA + '_' + market.assetB + ".json";
|
||||
|
||||
let report = {
|
||||
@@ -1007,7 +865,7 @@ Read the candles and volumes from Bruce and produce a single Index File for each
|
||||
logger.write("[INFO] 'writeStatusReport' - Content written: " + fileContent);
|
||||
}
|
||||
|
||||
callBack();
|
||||
closeAndOpenMarket();
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
+2
-23
@@ -7,8 +7,8 @@
|
||||
},
|
||||
"processes": [
|
||||
{
|
||||
"name": "Multi-Period-Market",
|
||||
"description": "Produces different files with multi-period candles and volumes for entire markets.",
|
||||
"name": "Candles-Volumes-Stairs-Market",
|
||||
"description": "Produces for each market two files with candles stairs and volumes stairs respectively.",
|
||||
"startMode": {
|
||||
"allMonths": {
|
||||
"run": "false",
|
||||
@@ -26,27 +26,6 @@
|
||||
},
|
||||
"intervalLapse": 3600000,
|
||||
"intervalMaxLoops": -1
|
||||
},
|
||||
{
|
||||
"name": "Multi-Period-Daily",
|
||||
"description": "Produces different files with multi-period candles and volumes on a daily format.",
|
||||
"startMode": {
|
||||
"allMonths": {
|
||||
"run": "false",
|
||||
"minYear": "",
|
||||
"maxYear": ""
|
||||
},
|
||||
"oneMonth": {
|
||||
"run": "false",
|
||||
"year": "",
|
||||
"month": ""
|
||||
},
|
||||
"noTime": {
|
||||
"run": "true"
|
||||
}
|
||||
},
|
||||
"intervalLapse": 60000,
|
||||
"intervalMaxLoops": -1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user