From f493818e5809518eaa2cdd701aff98133af7ee37 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 16 Mar 2018 17:47:46 +0100 Subject: [PATCH] Lives Trades Running --- .vs/AACharly-Extraction-Bot/v15/.suo | Bin 23040 -> 22528 bytes Poloniex-Live-Trades/User.bot.js | 40 +++++++++++++-------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.vs/AACharly-Extraction-Bot/v15/.suo b/.vs/AACharly-Extraction-Bot/v15/.suo index 25dcf7c3dbcd54b5966a909ed8aefa961f68c095..a505471d8dc6452b98e03c58d8356af0688b5b37 100644 GIT binary patch delta 972 zcmb_bJ#5oZ5cYH8*wE+JPEsd<*0g~jXv<%r13x7VF^H-XPL)6<2FOq$kXVo`5kLr! z3=Ac=!@!8dj~)v`NRg0O7zl!a0Tqc6I)lIHOii+C!XGP4}n!@Hqb?Xu{D_CWt=1+Jc7QZLetmWYk-|J3^|&_^)n7QBl|}C5MCz%PIG_e}!85Hu#YN z<+xOn#$nhfD`njL6=pLt;AD=}D-B2-eQiE`zI;h5l$Sm!gXi=9sk0KEs{{Dh4d%W?6Kb^j; zvCd;Nmc)=F{)AyjYy$4eh5h;}Z)%SQ*zetwTkpQ{5m--sf%n>sxP+1uc%1O0ff23= z;cHZp3GZyn0PsLW4$G!z8snn^0E z-B)LJnnM++6z8CE_HJgYP<5xl&$i42O7)mLcPNW7!o?mOWJV&aAVR`v=99(q7?vVA z2yD-4TbGHlzJn}vMN@aX6BGEMsZ-a}*{yU+h)INi9eTm|mpc@`CZ2(>gT1>c1FoPvYvAK~ZdD1`F@ ze$D3)1{h@n>~c~~mP`7uPya~!u@AN}-oUu}7G6{u>ifN${Ne&ndIcE!w?OTx{&G?K E3vA~==Kufz diff --git a/Poloniex-Live-Trades/User.bot.js b/Poloniex-Live-Trades/User.bot.js index 688a513cd..310d9e109 100644 --- a/Poloniex-Live-Trades/User.bot.js +++ b/Poloniex-Live-Trades/User.bot.js @@ -29,7 +29,7 @@ let poloniexApiClient = new POLONIEX_CLIENT_MODULE(); let statusReportModule = STATUS_REPORT.newStatusReport(BOT, DEBUG_MODULE, FILE_STORAGE, UTILITIES); - return interval; + return thisObject; function initialize(yearAssigend, monthAssigned, callBackFunction) { @@ -93,7 +93,7 @@ Array of records with this information: */ - function start() { + function start(callBackFunction) { try { @@ -123,15 +123,15 @@ Array of records with this information: if (FULL_LOG === true) { logger.write("[INFO] start -> createFolders -> Entering function."); } - currentDate = new Date(); + currentDate = global.processDatetime; previousMinute = new Date(currentDate.valueOf() - 60000); dateForPathA = currentDate.getUTCFullYear() + '/' + utilities.pad(currentDate.getUTCMonth() + 1, 2) + '/' + utilities.pad(currentDate.getUTCDate(), 2) + '/' + utilities.pad(currentDate.getUTCHours(), 2) + '/' + utilities.pad(currentDate.getUTCMinutes(), 2); dateForPathB = previousMinute.getUTCFullYear() + '/' + utilities.pad(previousMinute.getUTCMonth() + 1, 2) + '/' + utilities.pad(previousMinute.getUTCDate(), 2) + '/' + utilities.pad(previousMinute.getUTCHours(), 2) + '/' + utilities.pad(previousMinute.getUTCMinutes(), 2); - filePathA = EXCHANGE_NAME + "/Output/" + TRADES_FOLDER_NAME + '/' + dateForPathA; - filePathB = EXCHANGE_NAME + "/Output/" + TRADES_FOLDER_NAME + '/' + dateForPathB; + filePathA = global.FILE_PATH_ROOT + "/Output/" + TRADES_FOLDER_NAME + '/' + dateForPathA; + filePathB = global.FILE_PATH_ROOT + "/Output/" + TRADES_FOLDER_NAME + '/' + dateForPathB; utilities.createFolderIfNeeded(filePathA, charlyFileStorage, onFolderACreated); @@ -175,7 +175,7 @@ Array of records with this information: } catch (err) { logger.write("[ERROR] start -> createFolders -> err = " + err.message); - callBack(global.DEFAULT_FAIL_RESPONSE); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); } } @@ -201,11 +201,11 @@ Array of records with this information: } catch (err) { logger.write("[ERROR] start -> getTheTrades -> err = " + err.message); - callBack(global.DEFAULT_FAIL_RESPONSE); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); } } - function onExchangeCallReturned(err, tradesRequested) { + function onExchangeCallReturned(err, exchangeResponse) { try { @@ -222,16 +222,16 @@ Array of records with this information: function onResponseOk() { - tradesReadyToBeSaved(tradesRequested); + tradesReadyToBeSaved(exchangeResponse); } } catch (err) { logger.write("[ERROR] start -> onExchangeCallReturned -> err = " + err.message); - callBack(global.DEFAULT_FAIL_RESPONSE); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); } } - function tradesReadyToBeSaved(tradesRequested) { + function tradesReadyToBeSaved(exchangeResponse) { try { @@ -254,9 +254,9 @@ Array of records with this information: fileContent = fileContent + '['; - for (i = 0; i < tradesRequested.length; i++) { + for (i = 0; i < exchangeResponse.length; i++) { - let record = tradesRequested[tradesRequested.length - 1 - i]; // In Poloniex the order of the records is by date DESC so we change it to ASC + let record = exchangeResponse[exchangeResponse.length - 1 - i]; // In Poloniex the order of the records is by date DESC so we change it to ASC const trade = { tradeIdAtExchange: record.tradeID, @@ -319,9 +319,9 @@ Array of records with this information: fileContent = fileContent + '['; - for (i = 0; i < tradesRequested.length; i++) { + for (i = 0; i < exchangeResponse.length; i++) { - let record = tradesRequested[tradesRequested.length - 1 - i]; // In Poloniex the order of the records is by date DESC so we change it to ASC + let record = exchangeResponse[exchangeResponse.length - 1 - i]; // In Poloniex the order of the records is by date DESC so we change it to ASC const trade = { tradeIdAtExchange: record.tradeID, @@ -377,7 +377,7 @@ Array of records with this information: } } catch (err) { logger.write("[ERROR] start -> tradesReadyToBeSaved -> err = " + err.message); - callBack(global.DEFAULT_FAIL_RESPONSE); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); } } @@ -430,24 +430,24 @@ Array of records with this information: return; } - callBack(global.DEFAULT_OK_RESPONSE); + callBackFunction(global.DEFAULT_OK_RESPONSE); } } catch (err) { logger.write("[ERROR] start -> writeStatusReport -> onInitilized -> err = " + err.message); - callBack(global.DEFAULT_FAIL_RESPONSE); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); } } } catch (err) { logger.write("[ERROR] start -> writeStatusReport -> err = " + err.message); - callBack(global.DEFAULT_FAIL_RESPONSE); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); } } } catch (err) { logger.write("[ERROR] start -> err = " + err.message); - callBack(global.DEFAULT_FAIL_RESPONSE); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); } } };