Add short backtesting results

This commit is contained in:
Matthias 2022-04-07 06:59:08 +02:00
parent 44363be94e
commit 5828981646
2 changed files with 32 additions and 0 deletions

View File

@ -111,6 +111,29 @@ export default class BacktestResultView extends Vue {
get backtestResultStats() { get backtestResultStats() {
// Transpose Result into readable format // Transpose Result into readable format
const shortMetrics =
this.backtestResult?.trade_count_short && this.backtestResult?.trade_count_short > 0
? [
{ metric: '___', value: '___' },
{
metric: 'Long / Short',
value: `${this.backtestResult.trade_count_long} / ${this.backtestResult.trade_count_short}`,
},
{
metric: 'Total profit Long',
value: `${formatPercent(
this.backtestResult.profit_total_long || 0,
)} | ${this.formatPriceStake(this.backtestResult.profit_total_long_abs)}`,
},
{
metric: 'Total profit Short',
value: `${formatPercent(
this.backtestResult.profit_total_short || 0,
)} | ${this.formatPriceStake(this.backtestResult.profit_total_short_abs)}`,
},
]
: [];
return [ return [
{ {
metric: 'Total Profit', metric: 'Total Profit',
@ -170,6 +193,8 @@ export default class BacktestResultView extends Vue {
value: `${this.backtestResult.timedout_entry_orders} / ${this.backtestResult.timedout_exit_orders}`, value: `${this.backtestResult.timedout_entry_orders} / ${this.backtestResult.timedout_exit_orders}`,
}, },
...shortMetrics,
{ metric: '___', value: '___' }, { metric: '___', value: '___' },
{ metric: 'Min balance', value: this.formatPriceStake(this.backtestResult.csum_min) }, { metric: 'Min balance', value: this.formatPriceStake(this.backtestResult.csum_min) },
{ metric: 'Max balance', value: this.formatPriceStake(this.backtestResult.csum_max) }, { metric: 'Max balance', value: this.formatPriceStake(this.backtestResult.csum_max) },

View File

@ -127,6 +127,13 @@ export interface StrategyBacktestResult {
winner_holding_avg: number; winner_holding_avg: number;
winning_days: number; winning_days: number;
trade_count_long?: number;
trade_count_short?: number;
profit_total_long?: number;
profit_total_short?: number;
profit_total_long_abs?: number;
profit_total_short_abs?: number;
/** Start time of the backtest run */ /** Start time of the backtest run */
backtest_run_start_ts: number; backtest_run_start_ts: number;
/** End time of the backtest run */ /** End time of the backtest run */