From e98563712d468f9b9d64211ec89788240e3958ef Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 9 Feb 2018 14:17:20 +0100 Subject: [PATCH] Code cleanup --- .vs/AABruce/v15/.suo | Bin 23040 -> 23040 bytes AABruce.njsproj | 2 +- One-Min-Daily-Candles/Interval.js | 44 +++--------------- ...es.js => One Min Daily Candles Volumes.js} | 2 +- One-Min-Daily-Candles/run.js | 4 +- 5 files changed, 11 insertions(+), 41 deletions(-) rename One-Min-Daily-Candles/{One Min Daily Candles.js => One Min Daily Candles Volumes.js} (98%) diff --git a/.vs/AABruce/v15/.suo b/.vs/AABruce/v15/.suo index a95df35954a5674b31b7755532a04a9332339d15..2a28858b8200212e10c7c08ec5437bf8e9c9d305 100644 GIT binary patch delta 748 zcmZqJ!q~8daYGIhUxLGPmlX>yGx9S4f!O3KrYgqp&0m?A85t8N|6~qk6$J`wPYz@W zXB64IkRzON5>qbA+FkdTZ!Tne&(0$Wl>PVr|9=pkoWrHSp#l|{JcX-5&>hHe1!6a- zpvPoJF5$@r+zPCrK#{P?zTB%P36wDUOfD6uXY`)@m8YK3YjUYzJ)`I3uRv02bE!~0 z51T4bEfdG&Uvj?~r8j?-f5*bB$;iL}L|~jUnbFW=vW2PwWo|ondmIj^^ZCEn$v`^IRZ4!{iH^7Ly%;!5P`|D25OTG4@@@HRgy(mDRqDyXrCDn^8hh35Hm~`R8^h4D@14W Ih2Ra00Hv?cl>h($ delta 179 zcmZqJ!q~8daYGIhUxOu|<(!3=8TlC)7#c(;S20yh{=yb8*@bxvquk`5%)yg=xCAE0 zu=p@)Z(hg|&NzuFhxNnLn)S0b7qY!)-<-hpm~rx9Cd0`kJpPjp3m8uR!gFEr5kUh+ z_sL%c>nE2O`ENcfWXQAmi(NdQpfNMh4k%~ - + diff --git a/One-Min-Daily-Candles/Interval.js b/One-Min-Daily-Candles/Interval.js index 248dcc463..ea1138400 100644 --- a/One-Min-Daily-Candles/Interval.js +++ b/One-Min-Daily-Candles/Interval.js @@ -124,12 +124,8 @@ Read the trades from Charly's Output and pack them into daily files with candles } - let nextIntervalExecution = false; // This tell weather the Interval module will be executed again or not. By default it will not unless some hole have been found in the current execution. - let currentDate; // This will hold the current datetime of each execution. - let cursorDatetime; // This holds the datetime we are using to request records from, backwards. - let marketQueue; // This is the queue of all markets to be procesesd at each interval. let market = { // This is the current market being processed after removing it from the queue. id: 0, @@ -137,34 +133,9 @@ Read the trades from Charly's Output and pack them into daily files with candles assetB: "" }; - let dateForPath; - - let filePath; - - - const FIRST_TRADE_RECORD_ID = -1; - const UNKNOWN_TRADE_RECORD_ID = -2; - - let tradesWithHole = []; // File content of the file where a hole was discovered. - - let currentTradeId; // This points to the last Trade Id that is ok. - let currentDatetime; // This points to the last Trade datetime that is ok. - - /* The next 3 variables hold the information read from varios Status Reports. */ - - let lastLiveTradeFile; // Datetime of the last complete trades file written by the Live Trades process. - let lastHistoricTradeFile; // Datatime of the last trades file written by the Historic Trades process. - let lastCandleFile; // Datetime of the last file certified by the Hole Fixing process as without permanent holes. - - /* The next 4 variables hold the results of the search of the next hole. */ - - let holeInitialId; // This is the Id just before the hole. - let holeInitialDatetime; // This is the Datetime just before the hole. - - let holeFinalId; // This is the Id just after the hole. - let holeFinalDatetime; // This is the Datetime just after the hole. - - let holeFixingStatusReport; // Current hole Fixing Status Report. + let lastCandleFile; // Datetime of the last file certified by the Hole Fixing process as without permanent holes. + let firstTradeFile; // Datetime of the first trade file in the whole market history. + let lastFileWithoutHoles; // Datetime of the last verified file without holes. marketsLoop(); @@ -183,7 +154,6 @@ Read the trades from Charly's Output and pack them into daily files with candles logger.write("[INFO] Entering function 'marketsLoop'"); } - currentDate = new Date(); markets.getMarketsByExchange(EXCHANGE_ID, onMarketsReady); function onMarketsReady(marketsArray) { @@ -293,14 +263,12 @@ Read the trades from Charly's Output and pack them into daily files with candles openMarket(); } - /* - The following code executes for each market, trying to fix the hole in trades history. + The following code executes for each market. */ - function getStatusReport() { try { @@ -378,7 +346,7 @@ Read the trades from Charly's Output and pack them into daily files with candles } else { - if (holeFixingStatusReport.monthChecked === true) { + if (statusReport.monthChecked === true) { lastFileWithoutHoles = new Date(); // We need this with a valid value. getOneMinDailyCandles(); @@ -619,6 +587,8 @@ Read the trades from Charly's Output and pack them into daily files with candles function onFilesWritten() { + nextIntervalExecution = true; + const logText = "[ERR] 'buildCandles' - Head of the market reached for market " + market.assetA + '_' + market.assetB + " . "; logger.write(logText); diff --git a/One-Min-Daily-Candles/One Min Daily Candles.js b/One-Min-Daily-Candles/One Min Daily Candles Volumes.js similarity index 98% rename from One-Min-Daily-Candles/One Min Daily Candles.js rename to One-Min-Daily-Candles/One Min Daily Candles Volumes.js index 7c67dc32a..8730d3639 100644 --- a/One-Min-Daily-Candles/One Min Daily Candles.js +++ b/One-Min-Daily-Candles/One Min Daily Candles Volumes.js @@ -5,7 +5,7 @@ const INTERVAL_LAPSE = 60 * 1000; - const MODULE_NAME = "One Min Daily Candles"; + const MODULE_NAME = "One Min Daily Candles Volumes"; const LOG_INFO = true; const INTERVAL_MODULE = require('./Interval'); diff --git a/One-Min-Daily-Candles/run.js b/One-Min-Daily-Candles/run.js index b43ed4588..6709c1210 100644 --- a/One-Min-Daily-Candles/run.js +++ b/One-Min-Daily-Candles/run.js @@ -1,7 +1,7 @@  let bot = { name: "Bruce", - process: "One-Min-Daily-Candles", + process: "One-Min-Daily-Candles-Volumes", type: "Indicator", version: "1.0.0", devTeam: "AA Masters" @@ -14,7 +14,7 @@ const MODULE_NAME = "run"; const START_ONE_MIN_DAILY_CANDLES = true; const START_ONE_MIN_DAILY_CANDLES_AT_ONE_MONTH = false; -const ONE_MIN_DAILY_CANDLES_MODULE = require('./One Min Daily Candles'); +const ONE_MIN_DAILY_CANDLES_MODULE = require('./One Min Daily Candles Volumes'); const DEBUG_MODULE = require(ROOT_DIR + 'Debug Log'); const logger = DEBUG_MODULE.newDebugLog();