undefined at file BUG resolved

This commit is contained in:
Luis Fernando Molina committed 2019-03-19 20:38:50 +01:00
1 parent 22460d1e1d
commit 5ca1812656
1 file changed
+11 -6
+11 -6
View File
@@ -134,8 +134,9 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
let yesterday = {};
yesterday.balanceAssetA = 0;
yesterday.balanceAssetB = 0;
yesterday.balanceAssetA = balanceAssetA;
yesterday.balanceAssetB = balanceAssetB;
yesterday.lastProfit = 0;
yesterday.Roundtrips = 0;
@@ -165,6 +166,9 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
balanceAssetA = interExecutionMemory.balanceAssetA;
balanceAssetB = interExecutionMemory.balanceAssetB;
yesterday.balanceAssetA = balanceAssetA;
yesterday.balanceAssetB = balanceAssetB;
}
lastProfit = interExecutionMemory.lastProfit;
@@ -632,6 +636,8 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
balanceAssetB = balanceAssetA * candle.close;
balanceAssetA = 0;
sellInstant = candle.end;
if (currentDay !== undefined) {
if (sellInstant < currentDay.valueOf()) {
yesterday.balanceAssetA = balanceAssetA;
@@ -642,8 +648,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
rate = candle.close;
sellRate = rate;
sellInstant = candle.end;
stopLoss = sellRate + sellRate * stopLossPercentage / 100;
stopLossDecay = 0;
@@ -677,8 +682,8 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
lastProfitPercent = lastProfit / previousBalanceAssetA * 100;
if (isNaN(lastProfitPercent)) { lastProfitPercent = 0; }
profit = profit + lastProfit;
profit = initialBalanceA - balanceAssetA;
ROI = (initialBalanceA + profit) / initialBalanceA - 1;
//if (isNaN(ROI)) { ROI = 0; }