Fix render bug with empty backtest result

This commit is contained in:
Matthias 2022-12-10 14:20:47 +01:00
parent 8cc4488a02
commit 2b60322614

View File

@ -87,14 +87,21 @@ const getSortedTrades = (backtestResult: StrategyBacktestResult): Trade[] => {
const bestPair = computed((): string => {
const trades = getSortedTrades(props.backtestResult);
if (trades.length === 0) {
return 'N/A';
}
const value = trades[trades.length - 1];
return `${value.pair} ${formatPercent(value.profit_ratio, 2)}`;
});
const worstPair = computed((): string => {
const trades = getSortedTrades(props.backtestResult);
if (trades.length === 0) {
return 'N/A';
}
const value = trades[0];
return `${value.pair} ${formatPercent(value.profit_ratio, 2)}`;
});
const backtestResultStats = computed(() => {
// Transpose Result into readable format
const shortMetrics =