From 18e9cfd240042ae42a25e9b997aa8376b3b94df4 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 8 Dec 2020 19:35:06 +0100 Subject: [PATCH] Improve backtesting ui --- src/types/backtest.ts | 2 ++ src/views/Backtesting.vue | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/types/backtest.ts b/src/types/backtest.ts index 290481ab..b37f570e 100644 --- a/src/types/backtest.ts +++ b/src/types/backtest.ts @@ -3,6 +3,8 @@ import { Trade } from './trades'; export interface BacktestPayload { strategy: string; timerange: string; + max_open_trades?: number; + stake_amount?: number; } export interface PairResult { diff --git a/src/views/Backtesting.vue b/src/views/Backtesting.vue index 6ce11a6b..759ee2c7 100644 --- a/src/views/Backtesting.vue +++ b/src/views/Backtesting.vue @@ -71,6 +71,7 @@ > @@ -84,20 +85,21 @@ > - + @@ -231,6 +233,10 @@ export default class Backtesting extends Vue { timerange = ''; + maxOpenTrades = ''; + + stakeAmount = ''; + // eslint-disable-next-line @typescript-eslint/no-unused-vars @ftbot.Action startBacktest!: (payload: BacktestPayload) => void; @@ -265,6 +271,15 @@ export default class Backtesting extends Vue { strategy: this.strategy, timerange: this.timerange, }; + if (this.maxOpenTrades && Number.isSafeInteger(this.maxOpenTrades)) { + // eslint-disable-next-line @typescript-eslint/camelcase + btPayload.max_open_trades = parseInt(this.maxOpenTrades, 10); + } + if (this.stakeAmount && Number.isSafeInteger(this.stakeAmount)) { + // eslint-disable-next-line @typescript-eslint/camelcase + btPayload.stake_amount = Number(this.stakeAmount); + } + this.startBacktest(btPayload); }