Add winrate to backtest results

closes #1372
This commit is contained in:
Matthias 2023-07-20 20:47:30 +02:00
parent c8517939e0
commit b1266bd4f6
2 changed files with 21 additions and 8 deletions

View File

@ -79,6 +79,7 @@ import {
formatPercent,
formatPrice,
humanizeDurationFromSeconds,
isNotUndefined,
} from '@/shared/formatters';
import { TableField, TableItem } from 'bootstrap-vue-next';
@ -115,6 +116,10 @@ const worstPair = computed((): string => {
return `${value.pair} ${formatPercent(value.profit_ratio, 2)}`;
});
const pairSummary = computed(() => {
return props.backtestResult.results_per_pair[props.backtestResult.results_per_pair.length - 1];
});
const backtestResultStats = computed(() => {
// Transpose Result into readable format
const shortMetrics =
@ -198,14 +203,19 @@ const backtestResultStats = computed(() => {
{
metric: 'Win/Draw/Loss',
value: `${
props.backtestResult.results_per_pair[props.backtestResult.results_per_pair.length - 1].wins
} / ${
props.backtestResult.results_per_pair[props.backtestResult.results_per_pair.length - 1]
.draws
} / ${
props.backtestResult.results_per_pair[props.backtestResult.results_per_pair.length - 1]
.losses
value: `${pairSummary.value.wins} / ${pairSummary.value.draws} / ${
pairSummary.value.losses
} ${
isNotUndefined(pairSummary.value.winrate)
? '(WR: ' +
formatPercent(
props.backtestResult.results_per_pair[
props.backtestResult.results_per_pair.length - 1
].winrate ?? 0,
2,
) +
')'
: ''
}`,
},
{

View File

@ -32,6 +32,7 @@ export interface PairResult {
profit_total: number;
trades: number;
wins: number;
winrate?: number;
}
export interface ExitReasonResults {
@ -48,6 +49,7 @@ export interface ExitReasonResults {
profit_total_pct: number;
trades: number;
wins: number;
winrate?: number;
}
// Generated by https://quicktype.io
@ -59,6 +61,7 @@ export interface PeriodicStat {
wins: number;
draws: number;
loses: number;
winrate?: number;
}
export interface PeriodicBreakdown {