Allow setting Protections dynamically

This commit is contained in:
Matthias 2021-01-06 20:25:38 +01:00
parent 6d99f2ee8a
commit b8b58b885c
3 changed files with 29 additions and 12 deletions

View File

@ -8,11 +8,6 @@
<b-table class="table-sm" :items="backtestResultStats" :fields="backtestResultFields">
</b-table>
</b-card>
<b-card header="Results per pair" class="mt-2">
<b-table class="table-sm" :items="backtestResult.results_per_pair" :fields="perPairFields">
</b-table>
</b-card>
<b-card header="Results per Sell-reason" class="mt-2">
<b-table
class="table-sm"
@ -21,6 +16,10 @@
>
</b-table>
</b-card>
<b-card header="Results per pair" class="mt-2">
<b-table class="table-sm" :items="backtestResult.results_per_pair" :fields="perPairFields">
</b-table>
</b-card>
<TradeList
class="trade-history mt-2"

View File

@ -6,6 +6,7 @@ export interface BacktestPayload {
timeframe?: string;
max_open_trades?: number;
stake_amount?: number;
enable_protections?: boolean;
}
export interface PairResult {

View File

@ -57,7 +57,7 @@
label-cols-sm="5"
label="Timeframe:"
label-align-sm="right"
label-for="timeframeSelect"
label-for="timeframe-select"
>
<b-form-select
id="timeframe-select"
@ -96,6 +96,19 @@
></b-form-input>
</b-form-group>
<b-form-group
label-cols-sm="5"
label="Enable Protections:"
label-align-sm="right"
label-for="enable-protections"
>
<b-form-checkbox
id="enable-protections"
v-model="enableProtections"
:options="availableTimeframes"
></b-form-checkbox>
</b-form-group>
<!-- <b-form-group label-cols-sm="5" label="Fee:" label-align-sm="right" label-for="fee">
<b-form-input
id="fee"
@ -232,6 +245,14 @@ export default class Backtesting extends Vue {
strategy = '';
timerange = '';
enableProtections = false;
maxOpenTrades = '';
stakeAmount = '';
btFormMode = 'run';
selectedPlotConfig: PlotConfig = getCustomPlotConfig(getPlotConfigName());
@ -245,12 +266,6 @@ export default class Backtesting extends Vue {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ftbot.Action public getPairHistory!: (payload: PairHistoryPayload) => void;
timerange = '';
maxOpenTrades = '';
stakeAmount = '';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ftbot.Action startBacktest!: (payload: BacktestPayload) => void;
@ -283,6 +298,8 @@ export default class Backtesting extends Vue {
const btPayload: BacktestPayload = {
strategy: this.strategy,
timerange: this.timerange,
// eslint-disable-next-line @typescript-eslint/camelcase
enable_protections: this.enableProtections,
};
const openTradesInt = parseInt(this.maxOpenTrades, 10);
if (openTradesInt) {