Removing INFO LOG and fixing BUG when scaling

This commit is contained in:
Luis Fernando Molina committed 2019-04-28 08:16:59 +02:00
1 parent 21bc8d7e6b
commit aeae50c6e4
2 files changed
+1 -95

No files matched your search

-49
View File
@@ -1,7 +1,6 @@
function newAAMastersPlottersTradingSimulationSimulationExecution() {
const MODULE_NAME = "Simulation Execution Plotter";
const INFO_LOG = false;
const INTENSIVE_LOG = false;
const ERROR_LOG = true;
const logger = newWebDebugLog();
@@ -63,8 +62,6 @@
function finalize() {
try {
if (INFO_LOG === true) { logger.write("[INFO] finalize -> Entering function."); }
/* Stop listening to the necesary events. */
viewPort.eventHandler.stopListening(offsetChangedEventSubscriptionId);
@@ -91,8 +88,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
datetime = pDatetime;
timePeriod = pTimePeriod;
@@ -123,8 +118,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
let container;
/* First we check if this point is inside this space. */
@@ -156,8 +149,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
timePeriod = pTimePeriod;
recalculate();
@@ -172,8 +163,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
datetime = newDatetime;
} catch (err) {
@@ -195,8 +184,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); }
if (fileSequence === undefined) { return; }
/*
@@ -444,8 +431,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> Entering function."); }
if (fileSequence === undefined) { return; } // We need the market file to be loaded to make the calculation.
if (timeLineCoordinateSystem.maxValue > 0) { return; } // Already calculated.
@@ -460,7 +445,6 @@
y: nextPorwerOf10(USDT_BTC_HTH) / 4 // TODO: This 4 is temporary
};
timeLineCoordinateSystem.initialize(
minValue,
maxValue,
@@ -468,39 +452,6 @@
thisObject.container.frame.height
);
function getMaxRate() {
try {
if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> getMaxRate > Entering function."); }
let maxValue = 0;
let maxSequence = fileSequence.getFilesLoaded();
for (let j = 0; j < maxSequence; j++) {
let file = fileSequence.getFile(j);
for (let i = 0; i < file.length; i++) {
let currentMax = file[i][1] + file[i][2]; // 1 = rates.
if (maxValue < currentMax) {
maxValue = currentMax;
}
}
}
return maxValue;
} catch (err) {
if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScale -> getMaxRate -> err = " + err); }
callBackFunction(GLOBAL.CUSTOM_FAIL_RESPONSE);
}
}
} catch (err) {
if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScale -> err = " + err); }
+1 -46
View File
@@ -1,7 +1,6 @@
function newAAMastersPlottersTradingSimulationTradingSimulation() {
const MODULE_NAME = "Simulation Plotter";
const INFO_LOG = false;
const ERROR_LOG = true;
const INTENSIVE_LOG = false;
const logger = newWebDebugLog();
@@ -71,8 +70,6 @@
function finalize() {
try {
if (INFO_LOG === true) { logger.write("[INFO] finalize -> Entering function."); }
/* Stop listening to the necesary events. */
viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId);
@@ -114,8 +111,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
/* Store the information received. */
marketFiles = pStorage.marketFiles[0];
@@ -197,8 +192,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
let container;
/* First we check if this point is inside this space. */
@@ -224,8 +217,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] onFilesUpdated -> Entering function."); }
let newMarketFile = marketFiles.getFile(timePeriod);
if (newMarketFile !== undefined) {
@@ -244,8 +235,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
if (timePeriod !== pTimePeriod) {
timePeriod = pTimePeriod;
@@ -278,8 +267,6 @@
function setDatetime(pDatetime) {
if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
datetime = pDatetime;
}
@@ -288,8 +275,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] onDailyFileLoaded -> Entering function."); }
if (event.currentValue === event.totalValue) {
/* This happens only when all of the files in the cursor have been loaded. */
@@ -324,8 +309,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); }
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
recalculateUsingMarketFiles();
@@ -348,8 +331,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingDailyFiles -> Entering function."); }
if (fileCursor === undefined) {
records = [];
return;
@@ -483,8 +464,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingMarketFiles -> Entering function."); }
if (marketFile === undefined) { return; } // Initialization not complete yet.
let daysOnSides = getSideDays(timePeriod);
@@ -580,10 +559,6 @@
try {
if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> Entering function."); }
if (marketFile === undefined) { return; } // We need the market file to be loaded to make the calculation.
if (timeLineCoordinateSystem.maxValue > 0) { return; } // Already calculated.
let minValue = {
@@ -593,10 +568,9 @@
let maxValue = {
x: MAX_PLOTABLE_DATE.valueOf(),
y: nextPorwerOf10(getMaxRate()) / 4 // TODO: This 4 is temporary
y: nextPorwerOf10(USDT_BTC_HTH) / 4 // TODO: This 4 is temporary
};
timeLineCoordinateSystem.initialize(
minValue,
maxValue,
@@ -604,25 +578,6 @@
thisObject.container.frame.height
);
function getMaxRate() {
if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> getMaxRate -> Entering function."); }
let maxValue = 0;
for (let i = 0; i < marketFile.length; i++) {
let currentMax = 25000; // TODO Fix this, since when there are not records above 10k the scales is dissincronized with the scale of the candles. marketFile[i][3]; // 3 = rate.
if (maxValue < currentMax) {
maxValue = currentMax;
}
}
return maxValue;
}
} catch (err) {
if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScale -> err = " + err.stack); }