diff --git a/.vs/AAMariam-Trading-Bot/v15/.suo b/.vs/AAMariam-Trading-Bot/v15/.suo index f4145eac2..f4eb38ccd 100644 Binary files a/.vs/AAMariam-Trading-Bot/v15/.suo and b/.vs/AAMariam-Trading-Bot/v15/.suo differ diff --git a/Project.njsproj b/Project.njsproj index e75e319d8..83de1393a 100644 --- a/Project.njsproj +++ b/Project.njsproj @@ -28,7 +28,6 @@ - @@ -41,7 +40,7 @@ - + diff --git a/Trading-Process/This.Bot.js b/This.Bot.js similarity index 92% rename from Trading-Process/This.Bot.js rename to This.Bot.js index f53bddcd0..e2eeda39f 100644 --- a/Trading-Process/This.Bot.js +++ b/This.Bot.js @@ -35,11 +35,11 @@ logger.write("[INFO] initialize -> Entering function 'initialize' "); - callBackFunction(null); + callBackFunction(DEFAULT_OK_RESPONSE); } catch (err) { logger.write("[ERROR] initialize -> onDone -> err = " + err.message); - callBackFunction("Operation Failed"); + callBackFunction(DEFAULT_FAIL_RESPONSE); } } @@ -64,18 +64,19 @@ function onDone(err) { try { - switch (err) { - case null: { - callBackFunction(null); + switch (err.result) { + case DEFAULT_OK_RESPONSE.result: { + callBackFunction(DEFAULT_OK_RESPONSE); + return; } break; - case 'Retry Later': { // Something bad happened, but if we retry in a while it might go through the next time. + case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time. logger.write("[ERROR] start -> onDone -> Retry Later. Requesting Execution Retry."); callBackFunction(err.message); return; } break; - case 'Retry Later': { // This is an unexpected exception that we do not know how to handle. + case DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle. logger.write("[ERROR] start -> onDone -> Operation Failed. Aborting the process."); callBackFunction(err.message); return; @@ -85,7 +86,7 @@ } catch (err) { logger.write("[ERROR] start -> onDone -> err = " + err.message); - callBackFunction("Operation Failed"); + callBackFunction(DEFAULT_FAIL_RESPONSE); } } @@ -173,7 +174,7 @@ } } catch (err) { logger.write("[ERROR] start -> businessLogic -> err = " + err.message); - callBack("Operation Failed"); + callBack(DEFAULT_FAIL_RESPONSE); } } @@ -187,7 +188,7 @@ } catch (err) { logger.write("[ERROR] start -> decideAboutBuyPosition -> err = " + err.message); - callBack("Operation Failed"); + callBack(DEFAULT_FAIL_RESPONSE); } } @@ -257,13 +258,13 @@ } catch (err) { logger.write("[ERROR] start -> decideAboutSellPosition -> err = " + err.message); - callBack("Operation Failed"); + callBack(DEFAULT_FAIL_RESPONSE); } } } catch (err) { logger.write("[ERROR] start -> err = " + err.message); - callBackFunction("Operation Failed"); + callBackFunction(DEFAULT_FAIL_RESPONSE); } } };