fix: Update pair profit calculation in backtest-resultChart
Some checks are pending
FreqUI CI / build (18, ubuntu-22.04) (push) Waiting to run
FreqUI CI / build (20, ubuntu-22.04) (push) Waiting to run
FreqUI CI / build (21, ubuntu-22.04) (push) Waiting to run
FreqUI CI / build (22, ubuntu-22.04) (push) Waiting to run

closes freqtrade/freqtrade#10651
This commit is contained in:
Matthias 2024-09-17 06:27:49 +02:00
parent c971a9b7f9
commit 50678f6ce8
2 changed files with 6 additions and 1 deletions

View File

@ -62,6 +62,7 @@ const navigateChartToTrade = (trade: Trade) => {
style="max-height: calc(100vh - 200px)" style="max-height: calc(100vh - 200px)"
:pairlist="backtestResult.pairlist" :pairlist="backtestResult.pairlist"
:trades="backtestResult.trades" :trades="backtestResult.trades"
:starting-balance="backtestResult.starting_balance"
sort-method="profit" sort-method="profit"
:backtest-mode="true" :backtest-mode="true"
/> />

View File

@ -22,6 +22,7 @@ const props = defineProps({
trades: { required: true, type: Array as () => Trade[] }, trades: { required: true, type: Array as () => Trade[] },
sortMethod: { default: 'normal', type: String }, sortMethod: { default: 'normal', type: String },
backtestMode: { required: false, default: false, type: Boolean }, backtestMode: { required: false, default: false, type: Boolean },
startingBalance: { required: false, type: Number, default: 0 },
}); });
const botStore = useBotStore(); const botStore = useBotStore();
const combinedPairList = computed(() => { const combinedPairList = computed(() => {
@ -46,6 +47,9 @@ const combinedPairList = computed(() => {
profit += trade.profit_ratio; profit += trade.profit_ratio;
profitAbs += trade.profit_abs ?? 0; profitAbs += trade.profit_abs ?? 0;
}); });
if (props.sortMethod == 'profit' && props.startingBalance) {
profit = profitAbs / props.startingBalance;
}
const tradeCount = trades.length; const tradeCount = trades.length;
const trade = tradeCount ? trades[0] : undefined; const trade = tradeCount ? trades[0] : undefined;
if (trades.length > 0) { if (trades.length > 0) {
@ -112,7 +116,7 @@ const combinedPairList = computed(() => {
button button
class="d-flex justify-content-between align-items-center py-1" class="d-flex justify-content-between align-items-center py-1"
:active="comb.pair === botStore.activeBot.selectedPair" :active="comb.pair === botStore.activeBot.selectedPair"
:title="`${comb.pair} - ${comb.tradeCount} trades`" :title="`${formatPriceCurrency(comb.profitAbs, botStore.activeBot.stakeCurrency, botStore.activeBot.stakeCurrencyDecimals)} - ${comb.pair} - ${comb.tradeCount} trades`"
@click="botStore.activeBot.selectedPair = comb.pair" @click="botStore.activeBot.selectedPair = comb.pair"
> >
<div> <div>