From f22fd26fb180500016c8910ec36fbd0f9b1b3aae Mon Sep 17 00:00:00 2001 From: matbenitez <34651529+matbenitez@users.noreply.github.com> Date: Mon, 7 May 2018 12:10:27 -0300 Subject: [PATCH] Partial orders Assistant: Fixing issue on patial orders. Context: reseting default amounts Poloniex API Client: Fixing issue when there is an issue with the connection. --- Assistant.js | 4 +++- Context.js | 4 ++-- Poloniex API Client.js | 12 ++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Assistant.js b/Assistant.js index 3b3119108..d1c0d63a9 100644 --- a/Assistant.js +++ b/Assistant.js @@ -704,7 +704,9 @@ logger.write("[ERROR] ordersExecutionCheck -> loopBody -> confirmOrderWasPartiallyExecuted -> sumAssetB = " + sumAssetB); logger.write("[ERROR] ordersExecutionCheck -> loopBody -> confirmOrderWasPartiallyExecuted -> Cannot be confirmed that a partially execution was done well."); - callBack(global.DEFAULT_FAIL_RESPONSE); + + /* There are diferences on the responses between the getPosition and getTrades that causes some issues, let's retry. */ + callBack(global.DEFAULT_RETRY_RESPONSE); return; } diff --git a/Context.js b/Context.js index 9e1bd430d..91e0a14ff 100644 --- a/Context.js +++ b/Context.js @@ -443,8 +443,8 @@ once we advance into multiple competitions scheme. */ - const INITIAL_INVESTMENT_A = 57.23872937; // This is just for this release of the platform. - const INITIAL_INVESTMENT_B = 0; // This is just for this release of the platform. + const INITIAL_INVESTMENT_A = 0; // This is just for this release of the platform. + const INITIAL_INVESTMENT_B = .001; // This is just for this release of the platform. thisObject.executionContext = { investment: { // This is used to calculate profits. diff --git a/Poloniex API Client.js b/Poloniex API Client.js index f5e6cc60d..f8bfd88b9 100644 --- a/Poloniex API Client.js +++ b/Poloniex API Client.js @@ -403,16 +403,16 @@ logger.write("[INFO] analizeResponse -> exchangeErr = " + stringExchangeErr); logger.write("[INFO] analizeResponse -> exchangeResponse = " + stringExchangeResponse); - if ( - stringExchangeResponse.indexOf("Connection timed out") > 0 || - stringExchangeResponse.indexOf("Connection Error") > 0 || - stringExchangeResponse.indexOf("Bad gateway") > 0 || - stringExchangeErr.indexOf("ETIMEDOUT") > 0 || + if (stringExchangeErr.indexOf("ETIMEDOUT") > 0 || stringExchangeErr.indexOf("ENOTFOUND") > 0 || stringExchangeErr.indexOf("ECONNREFUSED") > 0 || stringExchangeErr.indexOf("ESOCKETTIMEDOUT") > 0 || stringExchangeErr.indexOf("ECONNRESET") > 0 || - stringExchangeResponse.indexOf("Internal error. Please try again") > 0) { + (stringExchangeResponse !== undefined && ( + stringExchangeResponse.indexOf("Connection timed out") > 0 || + stringExchangeResponse.indexOf("Connection Error") > 0 || + stringExchangeResponse.indexOf("Bad gateway") > 0 || + stringExchangeResponse.indexOf("Internal error. Please try again") > 0))) { logger.write("[WARN] analizeResponse -> Timeout reached or connection problem while trying to access the Exchange API. Requesting new execution later."); notOkCallBack(global.DEFAULT_RETRY_RESPONSE);