Error Handling at ProductStorage
This commit is contained in:
1 parent
6fce637fa6
commit
6a62c07e51
12 files changed
+448
-387
No files matched your search
Binary file not shown.
@@ -37,7 +37,7 @@ let splashScreenNeeded = true;
|
||||
function newCanvas() {
|
||||
|
||||
const MODULE_NAME = "Canvas";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -75,7 +75,7 @@ function newCanvas() {
|
||||
|
||||
function initialize() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
|
||||
initializeBrowserCanvas();
|
||||
|
||||
@@ -120,7 +120,7 @@ function newCanvas() {
|
||||
|
||||
function initializeBrowserCanvas() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeBrowserCanvas -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeBrowserCanvas -> Entering function."); }
|
||||
|
||||
browserCanvas = document.getElementById('canvas');
|
||||
browserCanvasContext = browserCanvas.getContext('2d');
|
||||
@@ -136,7 +136,7 @@ function newCanvas() {
|
||||
|
||||
function clearBrowserCanvas() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] clearBrowserCanvas -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] clearBrowserCanvas -> Entering function."); }
|
||||
|
||||
browserCanvasContext.clearRect(0, 0, browserCanvas.width, browserCanvas.height);
|
||||
|
||||
@@ -144,7 +144,7 @@ function newCanvas() {
|
||||
|
||||
function addCanvasEvents() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] addCanvasEvents -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] addCanvasEvents -> Entering function."); }
|
||||
|
||||
/* Mouse down and up events to control the drag of the canvas. */
|
||||
|
||||
@@ -168,7 +168,7 @@ function newCanvas() {
|
||||
|
||||
function onMouseDown(event) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onMouseDown -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onMouseDown -> Entering function."); }
|
||||
|
||||
/*
|
||||
|
||||
@@ -229,7 +229,7 @@ function newCanvas() {
|
||||
|
||||
function onMouseClick(event) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onMouseClick -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onMouseClick -> Entering function."); }
|
||||
|
||||
let point = {
|
||||
x: event.pageX,
|
||||
@@ -272,7 +272,7 @@ function newCanvas() {
|
||||
|
||||
function onMouseUp(event) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onMouseUp -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onMouseUp -> Entering function."); }
|
||||
|
||||
if (containerDragStarted || viewPortBeingDragged || ballDragStarted) {
|
||||
|
||||
@@ -294,7 +294,7 @@ function newCanvas() {
|
||||
|
||||
function onMouseMove(event) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onMouseMove -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onMouseMove -> Entering function."); }
|
||||
|
||||
viewPort.mousePosition.x = event.pageX;
|
||||
viewPort.mousePosition.y = event.pageY;
|
||||
@@ -324,7 +324,7 @@ function newCanvas() {
|
||||
|
||||
function onMouseWheel(event) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onMouseWheel -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onMouseWheel -> Entering function."); }
|
||||
|
||||
// cross-browser wheel delta
|
||||
var event = window.event || event; // old IE support
|
||||
@@ -368,7 +368,7 @@ function newCanvas() {
|
||||
|
||||
function checkDrag() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] checkDrag -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] checkDrag -> Entering function."); }
|
||||
|
||||
if (containerDragStarted === true || ballDragStarted === true || viewPortBeingDragged === true) {
|
||||
|
||||
|
||||
+10
-10
@@ -2,7 +2,7 @@
|
||||
function newFile() {
|
||||
|
||||
const MODULE_NAME = "File";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -18,8 +18,8 @@ function newFile() {
|
||||
|
||||
function initialize(pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
let exchange = ecosystem.getExchange(pProduct, pExchange);
|
||||
|
||||
@@ -38,26 +38,26 @@ function newFile() {
|
||||
|
||||
function onFileReceived(err, pFile) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Entering function."); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received OK Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> err.message = " + err.message); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
@@ -65,7 +65,7 @@ function newFile() {
|
||||
|
||||
default: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received Unexpected Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ function newFile() {
|
||||
|
||||
function getFile() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> Entering function."); }
|
||||
|
||||
return file;
|
||||
|
||||
|
||||
+12
-12
@@ -2,7 +2,7 @@
|
||||
function newFileCache() {
|
||||
|
||||
const MODULE_NAME = "File Cache";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -23,8 +23,8 @@ function newFileCache() {
|
||||
|
||||
function initialize(pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
let exchange = ecosystem.getExchange(pProduct, pExchange);
|
||||
|
||||
@@ -50,26 +50,26 @@ function newFileCache() {
|
||||
|
||||
function onFileReceived(err, file) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Entering function."); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received OK Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> err.message = " + err.message); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
@@ -77,7 +77,7 @@ function newFileCache() {
|
||||
|
||||
default: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received Unexpected Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ function newFileCache() {
|
||||
|
||||
function getFile(pPeriod) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> Entering function."); }
|
||||
|
||||
return files.get(pPeriod);
|
||||
|
||||
@@ -104,7 +104,7 @@ function newFileCache() {
|
||||
|
||||
function getExpectedFiles() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getExpectedFiles -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getExpectedFiles -> Entering function."); }
|
||||
|
||||
return marketFilesPeriods.length;
|
||||
|
||||
@@ -112,7 +112,7 @@ function newFileCache() {
|
||||
|
||||
function getFilesLoaded() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFilesLoaded -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFilesLoaded -> Entering function."); }
|
||||
|
||||
return filesLoaded;
|
||||
|
||||
|
||||
+17
-17
@@ -2,7 +2,7 @@
|
||||
function newFileCloud() {
|
||||
|
||||
const MODULE_NAME = "File Cloud";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -17,8 +17,8 @@ function newFileCloud() {
|
||||
|
||||
function initialize(pBot) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> pBot = " + pBot.codeName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> pBot = " + pBot.codeName); }
|
||||
|
||||
blobService = AzureStorage.Blob.createBlobServiceWithSas(pBot.storage.fileUri, pBot.storage.sas);
|
||||
|
||||
@@ -26,8 +26,8 @@ function newFileCloud() {
|
||||
|
||||
function getFile(pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pSet.filePath + "-" + pSet.fileName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pSet.filePath + "-" + pSet.fileName); }
|
||||
|
||||
let fileName = pSet.fileName;
|
||||
let filePath = pSet.filePath;
|
||||
@@ -83,8 +83,8 @@ function newFileCloud() {
|
||||
fileName = fileName.replace("@Sequence", pSequence);
|
||||
}
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> filePath = " + filePath); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> fileName = " + fileName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> filePath = " + filePath); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> fileName = " + fileName); }
|
||||
|
||||
try {
|
||||
|
||||
@@ -92,15 +92,15 @@ function newFileCloud() {
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[ERROR] getFile -> err = " + err); }
|
||||
if (INFO_LOG === true) { logger.write("[ERROR] getFile -> err = " + err); }
|
||||
|
||||
}
|
||||
|
||||
function onFileReceived(err, text, response) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> onFileReceived -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> onFileReceived -> filePath = " + filePath); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> onFileReceived -> fileName = " + fileName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> onFileReceived -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> onFileReceived -> filePath = " + filePath); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> onFileReceived -> fileName = " + fileName); }
|
||||
|
||||
let data;
|
||||
|
||||
@@ -113,14 +113,14 @@ function newFileCloud() {
|
||||
message: "File does not exist."
|
||||
};
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[WARN] getFile -> onFileReceived -> customErr.message = " + customErr.message); }
|
||||
if (INFO_LOG === true) { logger.write("[WARN] getFile -> onFileReceived -> customErr.message = " + customErr.message); }
|
||||
|
||||
callBackFunction(customErr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[ERROR] getFile -> onFileReceived -> Unexpected Error Ocurred."); }
|
||||
if (FULL_LOG === true) { logger.write("[ERROR] getFile -> onFileReceived -> err = " + err); }
|
||||
if (INFO_LOG === true) { logger.write("[ERROR] getFile -> onFileReceived -> Unexpected Error Ocurred."); }
|
||||
if (INFO_LOG === true) { logger.write("[ERROR] getFile -> onFileReceived -> err = " + err); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
|
||||
@@ -130,21 +130,21 @@ function newFileCloud() {
|
||||
|
||||
data = JSON.parse(text);
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> onFileReceived -> Data received is valid JSON."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> onFileReceived -> Data received is valid JSON."); }
|
||||
|
||||
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, data);
|
||||
return;
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[WARN] getFile -> onFileReceived -> err = " + err); }
|
||||
if (INFO_LOG === true) { logger.write("[WARN] getFile -> onFileReceived -> err = " + err); }
|
||||
|
||||
let customErr = {
|
||||
result: GLOBAL.CUSTOM_OK_RESPONSE.result,
|
||||
message: "Data not in JSON Format."
|
||||
};
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[WARN] getFile -> onFileReceived -> customErr.message = " + customErr.message); }
|
||||
if (INFO_LOG === true) { logger.write("[WARN] getFile -> onFileReceived -> customErr.message = " + customErr.message); }
|
||||
|
||||
callBackFunction(customErr, text);
|
||||
return;
|
||||
|
||||
+18
-18
@@ -2,7 +2,7 @@
|
||||
function newFileCursor() {
|
||||
|
||||
const MODULE_NAME = "File Cursor";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -35,8 +35,8 @@ function newFileCursor() {
|
||||
|
||||
function initialize(pFileCloud, pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pTimePeriod, pCursorDate, pCurrentTimePeriod, callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pSet.codeName + "-" + pPeriodName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pSet.codeName + "-" + pPeriodName); }
|
||||
|
||||
market = pMarket;
|
||||
exchange = pExchange;
|
||||
@@ -54,7 +54,7 @@ function newFileCursor() {
|
||||
|
||||
function setTimePeriod(pTimePeriod, pDatetime, callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
|
||||
/*
|
||||
|
||||
@@ -106,7 +106,7 @@ function newFileCursor() {
|
||||
|
||||
function enterSavingMode() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setTimePeriod -> enterSavingMode -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> enterSavingMode -> Entering function."); }
|
||||
|
||||
switch (timePeriod) {
|
||||
|
||||
@@ -182,7 +182,7 @@ function newFileCursor() {
|
||||
|
||||
function exitSavingMode() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setTimePeriod -> exitSavingMode -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> exitSavingMode -> Entering function."); }
|
||||
|
||||
switch (timePeriod) {
|
||||
|
||||
@@ -261,7 +261,7 @@ function newFileCursor() {
|
||||
|
||||
function setDatetime(pDatetime, callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
|
||||
|
||||
if (pDatetime === undefined) { return; }
|
||||
|
||||
@@ -274,7 +274,7 @@ function newFileCursor() {
|
||||
|
||||
function getFiles(callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFiles -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFiles -> Entering function."); }
|
||||
|
||||
let i = 0;
|
||||
let j = 0;
|
||||
@@ -285,7 +285,7 @@ function newFileCursor() {
|
||||
|
||||
function getNextFile() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFiles -> getNextFile -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFiles -> getNextFile -> Entering function."); }
|
||||
|
||||
let targetDate = new Date(cursorDate);
|
||||
targetDate.setUTCDate(targetDate.getUTCDate() + j);
|
||||
@@ -328,26 +328,26 @@ function newFileCursor() {
|
||||
|
||||
function onFileReceived(err, file) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFiles -> onFileReceived -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFiles -> onFileReceived -> Entering function."); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFiles -> onFileReceived -> Received OK Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFiles -> onFileReceived -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFiles -> onFileReceived -> Received FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFiles -> onFileReceived -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFiles -> onFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFiles -> onFileReceived -> err.message = " + err.message); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFiles -> onFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFiles -> onFileReceived -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
@@ -355,7 +355,7 @@ function newFileCursor() {
|
||||
|
||||
default: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received Unexpected Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileReceived -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -370,7 +370,7 @@ function newFileCursor() {
|
||||
|
||||
function controlLoop() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFiles -> controlLoop -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFiles -> controlLoop -> Entering function."); }
|
||||
|
||||
if (callBackFunction !== undefined) {
|
||||
|
||||
@@ -391,7 +391,7 @@ function newFileCursor() {
|
||||
|
||||
function collectGarbage() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] collectGarbage -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] collectGarbage -> Entering function."); }
|
||||
|
||||
date = removeTime(cursorDate);
|
||||
|
||||
@@ -414,7 +414,7 @@ function newFileCursor() {
|
||||
|
||||
function getExpectedFiles() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getExpectedFiles -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getExpectedFiles -> Entering function."); }
|
||||
|
||||
return minCursorSize;
|
||||
|
||||
|
||||
+16
-16
@@ -2,7 +2,7 @@
|
||||
function newFileCursorCache() {
|
||||
|
||||
const MODULE_NAME = "File Cursor Cache";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -29,8 +29,8 @@ function newFileCursorCache() {
|
||||
|
||||
function initialize(pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
callBackWhenFileReceived = callBackFunction;
|
||||
|
||||
@@ -67,26 +67,26 @@ function newFileCursorCache() {
|
||||
|
||||
function onFileReceived(err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onFileReceived -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onFileReceived -> Entering function."); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onFileReceived -> Received OK Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onFileReceived -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onFileReceived -> Received FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onFileReceived -> Received FAIL Response."); }
|
||||
callBackWhenFileReceived(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onFileReceived -> err.message = " + err.message); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onFileReceived -> err.message = " + err.message); }
|
||||
|
||||
callBackWhenFileReceived(err);
|
||||
return;
|
||||
@@ -94,7 +94,7 @@ function newFileCursorCache() {
|
||||
|
||||
default: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onFileReceived -> Received Unexpected Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onFileReceived -> Received Unexpected Response."); }
|
||||
callBackWhenFileReceived(err);
|
||||
return;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ function newFileCursorCache() {
|
||||
|
||||
function getFileCursor(pPeriod) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFileCursor -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFileCursor -> Entering function."); }
|
||||
|
||||
return fileCursors.get(pPeriod);
|
||||
|
||||
@@ -115,7 +115,7 @@ function newFileCursorCache() {
|
||||
|
||||
function setDatetime(pDatetime) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
|
||||
|
||||
filesLoaded = 0;
|
||||
expectedFiles = 0;
|
||||
@@ -129,13 +129,13 @@ function newFileCursorCache() {
|
||||
|
||||
}
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setDatetime -> expectedFiles = " + expectedFiles); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> expectedFiles = " + expectedFiles); }
|
||||
|
||||
}
|
||||
|
||||
function setTimePeriod(pTimePeriod, pDatetime) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
|
||||
filesLoaded = 0;
|
||||
expectedFiles = 0;
|
||||
@@ -149,13 +149,13 @@ function newFileCursorCache() {
|
||||
|
||||
}
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setTimePeriod -> expectedFiles = " + expectedFiles); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> expectedFiles = " + expectedFiles); }
|
||||
|
||||
}
|
||||
|
||||
function getExpectedFiles() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getExpectedFiles -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getExpectedFiles -> Entering function."); }
|
||||
|
||||
return expectedFiles;
|
||||
|
||||
@@ -163,7 +163,7 @@ function newFileCursorCache() {
|
||||
|
||||
function getFilesLoaded() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFilesLoaded -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFilesLoaded -> Entering function."); }
|
||||
|
||||
return filesLoaded;
|
||||
|
||||
|
||||
+21
-21
@@ -2,7 +2,7 @@
|
||||
function newFileSequence() {
|
||||
|
||||
const MODULE_NAME = "File Sequence";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -25,8 +25,8 @@ function newFileSequence() {
|
||||
|
||||
function initialize(pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
let exchange = ecosystem.getExchange(pProduct, pExchange);
|
||||
|
||||
@@ -45,27 +45,27 @@ function newFileSequence() {
|
||||
|
||||
function onSequenceFileReceived(err, file) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Received OK Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Received FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Received CUSTOM OK Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> err.message = " + err.message); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Received CUSTOM OK Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
@@ -73,8 +73,8 @@ function newFileSequence() {
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> err.message = " + err.message); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
@@ -82,7 +82,7 @@ function newFileSequence() {
|
||||
|
||||
default: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Received Unexpected Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -101,21 +101,21 @@ function newFileSequence() {
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> onFileReceived -> Received OK Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> onFileReceived -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> onFileReceived -> Received FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> onFileReceived -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> onFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> onFileReceived -> err.message = " + err.message); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> onFileReceived -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> onFileReceived -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
@@ -123,7 +123,7 @@ function newFileSequence() {
|
||||
|
||||
default: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> onFileReceived -> Received Unexpected Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSequenceFileReceived -> onFileReceived -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -142,8 +142,8 @@ function newFileSequence() {
|
||||
|
||||
function getFile(pSequence) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFile -> pSequence = " + pSequence); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFile -> pSequence = " + pSequence); }
|
||||
|
||||
return files.get(pSequence);
|
||||
|
||||
@@ -151,7 +151,7 @@ function newFileSequence() {
|
||||
|
||||
function getExpectedFiles() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getExpectedFiles -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getExpectedFiles -> Entering function."); }
|
||||
|
||||
return maxSequence + 1;
|
||||
|
||||
@@ -159,7 +159,7 @@ function newFileSequence() {
|
||||
|
||||
function getFilesLoaded() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getFilesLoaded -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getFilesLoaded -> Entering function."); }
|
||||
|
||||
return filesLoaded;
|
||||
|
||||
|
||||
+301
-240
@@ -2,7 +2,8 @@
|
||||
function newProductStorage(pName) {
|
||||
|
||||
const MODULE_NAME = "Product Storage";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const ERROR_LOG = true;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -13,6 +14,17 @@ function newProductStorage(pName) {
|
||||
|
||||
At the same time it will raise an event for each underlaying file being loaded, so that the UI can reflect the progress to the end user.
|
||||
|
||||
Product Storage
|
||||
|
|
||||
|
|
||||
|-----> File
|
||||
|
|
||||
|-----> FileSequence
|
||||
|
|
||||
|-----> FileCursorCache -----> FileCursor
|
||||
|
|
||||
|-----> FileCache
|
||||
|
||||
*/
|
||||
|
||||
let thisObject = {
|
||||
@@ -43,282 +55,330 @@ function newProductStorage(pName) {
|
||||
|
||||
function initialize(pDevTeam, pBot, pProduct, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
try {
|
||||
|
||||
datetime = pDatetime;
|
||||
timePeriod = pTimePeriod;
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
let dataSetsToLoad = 0;
|
||||
let dataSetsLoaded = 0;
|
||||
datetime = pDatetime;
|
||||
timePeriod = pTimePeriod;
|
||||
|
||||
for (let i = 0; i < pProduct.dataSets.length; i++) {
|
||||
let dataSetsToLoad = 0;
|
||||
let dataSetsLoaded = 0;
|
||||
|
||||
let thisSet = pProduct.dataSets[i];
|
||||
for (let i = 0; i < pProduct.dataSets.length; i++) {
|
||||
|
||||
switch (thisSet.type) {
|
||||
case 'Market Files': {
|
||||
let thisSet = pProduct.dataSets[i];
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Market Files -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
switch (thisSet.type) {
|
||||
case 'Market Files': {
|
||||
|
||||
thisObject.fileCache = newFileCache();
|
||||
thisObject.fileCache.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onCacheFileReady);
|
||||
dataSetsToLoad++;
|
||||
}
|
||||
break;
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Market Files -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
case 'Daily Files': {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Daily Files -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
thisObject.fileCursorCache = newFileCursorCache();
|
||||
thisObject.fileCursorCache.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, pDatetime, pTimePeriod, onFileCursorReady);
|
||||
dataSetsToLoad++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Single File': {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Single File -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
thisObject.file = newFile();
|
||||
thisObject.file.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onSingleFileReady);
|
||||
dataSetsToLoad++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'File Sequence': {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> File Sequence -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
thisObject.fileSequence = newFileSequence();
|
||||
thisObject.fileSequence.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onFileSequenceReady);
|
||||
dataSetsToLoad++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
function onCacheFileReady(err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> Received OK Response."); }
|
||||
thisObject.fileCache = newFileCache();
|
||||
thisObject.fileCache.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onCacheFileReady);
|
||||
dataSetsToLoad++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Daily Files': {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Daily Files -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
thisObject.fileCursorCache = newFileCursorCache();
|
||||
thisObject.fileCursorCache.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, pDatetime, pTimePeriod, onFileCursorReady);
|
||||
dataSetsToLoad++;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let event = {
|
||||
totalValue: thisObject.fileCache.getExpectedFiles(),
|
||||
currentValue: thisObject.fileCache.getFilesLoaded()
|
||||
}
|
||||
|
||||
thisObject.eventHandler.raiseEvent('Market File Loaded', event);
|
||||
|
||||
if (event.currentValue === event.totalValue) {
|
||||
|
||||
dataSetsLoaded++;
|
||||
|
||||
checkInitializeComplete();
|
||||
}
|
||||
}
|
||||
|
||||
function onFileCursorReady(err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> Received OK Response."); }
|
||||
break;
|
||||
|
||||
case 'Single File': {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Single File -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
thisObject.file = newFile();
|
||||
thisObject.file.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onSingleFileReady);
|
||||
dataSetsToLoad++;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let event = {
|
||||
totalValue: thisObject.fileCursorCache.getExpectedFiles(),
|
||||
currentValue: thisObject.fileCursorCache.getFilesLoaded()
|
||||
}
|
||||
|
||||
thisObject.eventHandler.raiseEvent('Daily File Loaded', event);
|
||||
|
||||
if (event.currentValue === event.totalValue) {
|
||||
|
||||
dataSetsLoaded++;
|
||||
|
||||
checkInitializeComplete();
|
||||
}
|
||||
}
|
||||
|
||||
function onSingleFileReady(err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> Received OK Response."); }
|
||||
break;
|
||||
|
||||
case 'File Sequence': {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> File Sequence -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
thisObject.fileSequence = newFileSequence();
|
||||
thisObject.fileSequence.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onFileSequenceReady);
|
||||
dataSetsToLoad++;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let event = {
|
||||
totalValue: 1,
|
||||
currentValue: 1
|
||||
}
|
||||
|
||||
thisObject.eventHandler.raiseEvent('Single File Loaded', event);
|
||||
|
||||
if (event.currentValue === event.totalValue) {
|
||||
|
||||
dataSetsLoaded++;
|
||||
|
||||
checkInitializeComplete();
|
||||
}
|
||||
}
|
||||
|
||||
function onFileSequenceReady(err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
function onCacheFileReady(err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> err.message = " + err.message); }
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onCacheFileReady -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let event = {
|
||||
totalValue: thisObject.fileCache.getExpectedFiles(),
|
||||
currentValue: thisObject.fileCache.getFilesLoaded()
|
||||
}
|
||||
|
||||
thisObject.eventHandler.raiseEvent('Market File Loaded', event);
|
||||
|
||||
if (event.currentValue === event.totalValue) {
|
||||
|
||||
dataSetsLoaded++;
|
||||
|
||||
checkInitializeComplete();
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> onCacheFileReady -> err = " + err); }
|
||||
callBackFunction(GLOBAL.CUSTOM_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
let event = {
|
||||
totalValue: thisObject.fileSequence.getExpectedFiles(),
|
||||
currentValue: thisObject.fileSequence.getFilesLoaded()
|
||||
function onFileCursorReady(err) {
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileCursorReady -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let event = {
|
||||
totalValue: thisObject.fileCursorCache.getExpectedFiles(),
|
||||
currentValue: thisObject.fileCursorCache.getFilesLoaded()
|
||||
}
|
||||
|
||||
thisObject.eventHandler.raiseEvent('Daily File Loaded', event);
|
||||
|
||||
if (event.currentValue === event.totalValue) {
|
||||
|
||||
dataSetsLoaded++;
|
||||
|
||||
checkInitializeComplete();
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> onFileCursorReady -> err = " + err); }
|
||||
callBackFunction(GLOBAL.CUSTOM_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
thisObject.eventHandler.raiseEvent('File Sequence Loaded', event);
|
||||
function onSingleFileReady(err) {
|
||||
|
||||
if (event.currentValue === event.totalValue) {
|
||||
try {
|
||||
|
||||
dataSetsLoaded++;
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
checkInitializeComplete();
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onSingleFileReady -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let event = {
|
||||
totalValue: 1,
|
||||
currentValue: 1
|
||||
}
|
||||
|
||||
thisObject.eventHandler.raiseEvent('Single File Loaded', event);
|
||||
|
||||
if (event.currentValue === event.totalValue) {
|
||||
|
||||
dataSetsLoaded++;
|
||||
|
||||
checkInitializeComplete();
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> onSingleFileReady -> err = " + err); }
|
||||
callBackFunction(GLOBAL.CUSTOM_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
function onFileSequenceReady(err) {
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> Received OK Response."); }
|
||||
break;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> Received FAIL Response."); }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> err.message = " + err.message); }
|
||||
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onFileSequenceReady -> Received Unexpected Response."); }
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let event = {
|
||||
totalValue: thisObject.fileSequence.getExpectedFiles(),
|
||||
currentValue: thisObject.fileSequence.getFilesLoaded()
|
||||
}
|
||||
|
||||
thisObject.eventHandler.raiseEvent('File Sequence Loaded', event);
|
||||
|
||||
if (event.currentValue === event.totalValue) {
|
||||
|
||||
dataSetsLoaded++;
|
||||
|
||||
checkInitializeComplete();
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> onFileSequenceReady -> err = " + err); }
|
||||
callBackFunction(GLOBAL.CUSTOM_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
function checkInitializeComplete() {
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] checkInitializeComplete -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] checkInitializeComplete -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
if (dataSetsLoaded === dataSetsToLoad) {
|
||||
|
||||
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE);
|
||||
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> checkInitializeComplete -> err = " + err); }
|
||||
callBackFunction(GLOBAL.CUSTOM_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkInitializeComplete() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] checkInitializeComplete -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] checkInitializeComplete -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); }
|
||||
|
||||
if (dataSetsLoaded === dataSetsToLoad) {
|
||||
|
||||
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE);
|
||||
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> err = " + err); }
|
||||
callBackFunction(GLOBAL.CUSTOM_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
function setDatetime(pDatetime) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
|
||||
|
||||
/* If there is a change in the day, then we take some actions, otherwise, we dont. */
|
||||
|
||||
@@ -335,11 +395,12 @@ function newProductStorage(pName) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setTimePeriod(pTimePeriod) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
|
||||
/* We are going to filter out the cases in which the timePeriod received is the same that the one we already know. */
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ changes, then all charts in it are replotted with the corresponging data.
|
||||
function newChartSpace() {
|
||||
|
||||
const MODULE_NAME = "Chart Space";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -41,7 +41,7 @@ function newChartSpace() {
|
||||
|
||||
function initialize() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
|
||||
/* We create the first of many possible time machines that could live at the Chart Space. */
|
||||
|
||||
@@ -83,7 +83,7 @@ function newChartSpace() {
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
|
||||
|
||||
var container;
|
||||
|
||||
|
||||
+7
-7
@@ -12,7 +12,7 @@ each one with it own charts, and each one positioned at an especific point in ti
|
||||
function newTimeMachine() {
|
||||
|
||||
const MODULE_NAME = "Time Machine";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -39,7 +39,7 @@ function newTimeMachine() {
|
||||
|
||||
function initialize() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
|
||||
/* Each Time Machine has a Control Panel. */
|
||||
|
||||
@@ -72,7 +72,7 @@ function newTimeMachine() {
|
||||
|
||||
function onDefaultMarketInitialized() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> onDefaultMarketInitialized -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onDefaultMarketInitialized -> Entering function."); }
|
||||
|
||||
thisObject.charts.push(timelineChart);
|
||||
|
||||
@@ -85,13 +85,13 @@ function newTimeMachine() {
|
||||
|
||||
function initializeTheRestOfTheMarkets() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> initializeTheRestOfTheMarkets -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> initializeTheRestOfTheMarkets -> Entering function."); }
|
||||
|
||||
markets.forEach(initializeTimelineChart);
|
||||
|
||||
function initializeTimelineChart(item, key, mapObj) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> initializeTheRestOfTheMarkets -> initializeTimelineChart -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> initializeTheRestOfTheMarkets -> initializeTimelineChart -> Entering function."); }
|
||||
|
||||
if (key === INITIAL_DEFAULT_MARKET) { // We skip this market since it has already been initialized.
|
||||
|
||||
@@ -117,7 +117,7 @@ function newTimeMachine() {
|
||||
|
||||
function finalSteps() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> initializeTheRestOfTheMarkets -> initializeTimelineChart -> finalSteps -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> initializeTheRestOfTheMarkets -> initializeTimelineChart -> finalSteps -> Entering function."); }
|
||||
|
||||
thisObject.charts.push(timelineChart);
|
||||
|
||||
@@ -145,7 +145,7 @@ function newTimeMachine() {
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
|
||||
|
||||
let container;
|
||||
|
||||
|
||||
+32
-32
@@ -1,7 +1,7 @@
|
||||
function newTimelineChart() {
|
||||
|
||||
const MODULE_NAME = "Timeline Chart";
|
||||
const FULL_LOG = false;
|
||||
const INFO_LOG = false;
|
||||
const logger = newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
function initialize(exchange, market, pProductsPanel, callBackFunction) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
|
||||
/* Remember the Products Panel */
|
||||
|
||||
@@ -80,9 +80,9 @@
|
||||
|
||||
function initializeCompetitionPlotters() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeCompetitionPlotters -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeCompetitionPlotters -> Entering function."); }
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeCompetitionPlotters -> Aborting function until Competition Plotter is ready."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeCompetitionPlotters -> Aborting function until Competition Plotter is ready."); }
|
||||
return;
|
||||
|
||||
/* At this current version of the platform, we will support only one competition with only one plotter. */
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
function onStorageInitialized(err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeCompetitionPlotters -> onStorageInitialized -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeCompetitionPlotters -> onStorageInitialized -> Entering function."); }
|
||||
|
||||
/* Now we have all the initial data loaded and ready to be delivered to the new instance of the plotter. */
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
function onPlotterInizialized() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeCompetitionPlotters -> onStorageInitialized -> onPlotterInizialized -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeCompetitionPlotters -> onStorageInitialized -> onPlotterInizialized -> Entering function."); }
|
||||
|
||||
let competitionPlotter = {
|
||||
plotter: plotter,
|
||||
@@ -138,7 +138,7 @@
|
||||
|
||||
function initializeProductPlotters() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotters -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotters -> Entering function."); }
|
||||
|
||||
/* Lets get all the cards that needs to be loaded. */
|
||||
|
||||
@@ -155,14 +155,14 @@
|
||||
|
||||
function initializeProductPlotter(pProductCard) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> Entering function."); }
|
||||
|
||||
/* Before Initializing a Plotter, we need the Storage it will use, loaded with the files it will initially need. */
|
||||
|
||||
let objName = pProductCard.devTeam.codeName + "-" + pProductCard.bot.codeName + "-" + pProductCard.product.codeName;
|
||||
let storage = newProductStorage(objName);
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> objName = " + objName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> objName = " + objName); }
|
||||
|
||||
/*
|
||||
|
||||
@@ -202,36 +202,36 @@
|
||||
|
||||
function onStorageInitialized(err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> key = " + pProductCard.devTeam.codeName + "-" + pProductCard.bot.codeName + "-" + pProductCard.product.codeName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> key = " + pProductCard.devTeam.codeName + "-" + pProductCard.bot.codeName + "-" + pProductCard.product.codeName); }
|
||||
|
||||
switch (err.result) {
|
||||
case GLOBAL.DEFAULT_OK_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> Received OK Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> The plotter will be started."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> Received OK Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> The plotter will be started."); }
|
||||
break;
|
||||
}
|
||||
|
||||
case GLOBAL.DEFAULT_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> Received FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> The plotter will not be started."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> Received FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> The plotter will not be started."); }
|
||||
return;
|
||||
}
|
||||
|
||||
case GLOBAL.CUSTOM_FAIL_RESPONSE.result: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> Received CUSTOM FAIL Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> err.message = " + err.message); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> The plotter will not be started."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> Received CUSTOM FAIL Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> err.message = " + err.message); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> The plotter will not be started."); }
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> Received Unexpected Response."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> The plotter will not be started."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> Received Unexpected Response."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> The plotter will not be started."); }
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -255,8 +255,8 @@
|
||||
|
||||
function onPlotterInizialized() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> onPlotterInizialized -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> onPlotterInizialized -> key = " + pProductCard.product.plotter.devTeam + "-" + pProductCard.product.plotter.repo + "-" + pProductCard.product.plotter.moduleName); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> onPlotterInizialized -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initializeProductPlotter -> onStorageInitialized -> onPlotterInizialized -> key = " + pProductCard.product.plotter.devTeam + "-" + pProductCard.product.plotter.repo + "-" + pProductCard.product.plotter.moduleName); }
|
||||
|
||||
try {
|
||||
plotter.positionAtDatetime(INITIAL_DATE);
|
||||
@@ -328,7 +328,7 @@
|
||||
|
||||
function onProductCardStatusChanged(pProductCard) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onProductCardStatusChanged -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onProductCardStatusChanged -> Entering function."); }
|
||||
|
||||
if (pProductCard.status === PRODUCT_CARD_STATUS.LOADING) {
|
||||
|
||||
@@ -385,7 +385,7 @@
|
||||
|
||||
function onZoomChanged(event) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onZoomChanged -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onZoomChanged -> Entering function."); }
|
||||
|
||||
if (initializationReady === true) {
|
||||
|
||||
@@ -425,7 +425,7 @@
|
||||
|
||||
function onDragFinished() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onDragFinished -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onDragFinished -> Entering function."); }
|
||||
|
||||
if (initializationReady === true) {
|
||||
|
||||
@@ -439,7 +439,7 @@
|
||||
|
||||
function onOffsetChanged() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] onOffsetChanged -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onOffsetChanged -> Entering function."); }
|
||||
|
||||
if (initializationReady === true) {
|
||||
|
||||
@@ -454,7 +454,7 @@
|
||||
|
||||
function recalculateCurrentDatetime() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] recalculateCurrentDatetime -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculateCurrentDatetime -> Entering function."); }
|
||||
|
||||
/*
|
||||
|
||||
@@ -500,7 +500,7 @@
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
|
||||
|
||||
var container;
|
||||
|
||||
@@ -521,7 +521,7 @@
|
||||
|
||||
function setDatetime(pDatetime) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
|
||||
|
||||
/* This function is used when the time is changed through the user interface, but without zooming or panning. */
|
||||
/* No matter if the day changed or not, we need to inform all visible Plotters. */
|
||||
@@ -587,7 +587,7 @@
|
||||
|
||||
function recalculateScale() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] recalculateScale -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> Entering function."); }
|
||||
|
||||
var minValue = {
|
||||
x: EARLIEST_DATE.valueOf(),
|
||||
@@ -621,7 +621,7 @@
|
||||
|
||||
function tooSmall() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] tooSmall -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] tooSmall -> Entering function."); }
|
||||
|
||||
if (viewPort.zoomLevel < Math.trunc(-27.25 * 100) / 100) {
|
||||
return true;
|
||||
@@ -706,7 +706,7 @@
|
||||
|
||||
function moveViewPortToCurrentDatetime() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] moveViewPortToCurrentDatetime -> Entering function."); }
|
||||
if (INFO_LOG === true) { logger.write("[INFO] moveViewPortToCurrentDatetime -> Entering function."); }
|
||||
|
||||
let targetPoint = {
|
||||
x: datetime.valueOf(),
|
||||
|
||||
Reference in new issue
Block a user