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); }