mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 11:35:14 +00:00
fully Support Cumprofitchart while no trade has been closed.
This commit is contained in:
parent
c60898c685
commit
b722e1ff0a
|
@ -107,16 +107,23 @@ const cumulativeData = computed<CumProfitChartData[]>(() => {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (props.openTrades.length > 0 && valueArray.length > 0) {
|
if (props.openTrades.length > 0) {
|
||||||
|
let lastProfit = 0;
|
||||||
|
let lastDate = 0;
|
||||||
|
if (valueArray.length > 0) {
|
||||||
const lastPoint = valueArray[valueArray.length - 1];
|
const lastPoint = valueArray[valueArray.length - 1];
|
||||||
if (lastPoint) {
|
lastProfit = lastPoint.profit ?? 0;
|
||||||
const resultWitHOpen = (lastPoint.profit ?? 0) + openProfit.value;
|
lastDate = lastPoint.date ?? 0;
|
||||||
valueArray.push({ date: lastPoint.date, currentProfit: lastPoint.profit });
|
} else {
|
||||||
|
lastDate = props.openTrades[0].open_timestamp;
|
||||||
|
}
|
||||||
|
const resultWitHOpen = (lastProfit ?? 0) + openProfit.value;
|
||||||
|
valueArray.push({ date: lastDate, currentProfit: lastProfit });
|
||||||
// Add one day to date to ensure it's showing properly
|
// Add one day to date to ensure it's showing properly
|
||||||
const tomorrow = Date.now() + 24 * 60 * 60 * 1000;
|
const tomorrow = Date.now() + 24 * 60 * 60 * 1000;
|
||||||
valueArray.push({ date: tomorrow, currentProfit: resultWitHOpen });
|
valueArray.push({ date: tomorrow, currentProfit: resultWitHOpen });
|
||||||
}
|
}
|
||||||
}
|
console.log(valueArray);
|
||||||
return valueArray;
|
return valueArray;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user