More refs to btStore

This commit is contained in:
Matthias 2023-07-22 11:18:04 +02:00
parent 07798d2d21
commit 2d3f1c7391
2 changed files with 13 additions and 12 deletions

View File

@ -7,6 +7,10 @@ export const useBtStore = defineStore('btStore', {
selectedTimeframe: '', selectedTimeframe: '',
selectedDetailTimeframe: '', selectedDetailTimeframe: '',
timerange: '', timerange: '',
maxOpenTrades: '',
stakeAmount: '',
startingCapital: '',
allowCache: true,
freqAI: { freqAI: {
enabled: false, enabled: false,
model: '', model: '',

View File

@ -140,7 +140,7 @@
> >
<b-form-input <b-form-input
id="max-open-trades" id="max-open-trades"
v-model="maxOpenTrades" v-model="btStore.maxOpenTrades"
placeholder="Use strategy default" placeholder="Use strategy default"
type="number" type="number"
></b-form-input> ></b-form-input>
@ -153,7 +153,7 @@
> >
<b-form-input <b-form-input
id="starting-capital" id="starting-capital"
v-model="startingCapital" v-model="btStore.startingCapital"
type="number" type="number"
step="0.001" step="0.001"
></b-form-input> ></b-form-input>
@ -174,7 +174,7 @@
<b-form-input <b-form-input
id="stake-amount" id="stake-amount"
v-model="stakeAmount" v-model="btStore.stakeAmount"
type="number" type="number"
placeholder="Use strategy default" placeholder="Use strategy default"
step="0.01" step="0.01"
@ -201,7 +201,7 @@
label-align-sm="right" label-align-sm="right"
label-for="enable-cache" label-for="enable-cache"
> >
<b-form-checkbox id="enable-cache" v-model="allowCache"></b-form-checkbox> <b-form-checkbox id="enable-cache" v-model="btStore.allowCache"></b-form-checkbox>
</b-form-group> </b-form-group>
<template v-if="botStore.activeBot.botApiVersion >= 2.22"> <template v-if="botStore.activeBot.botApiVersion >= 2.22">
<b-form-group <b-form-group
@ -364,12 +364,9 @@ const timeframe = computed((): string => {
}); });
const showLeftBar = ref(false); const showLeftBar = ref(false);
const enableProtections = ref(false); const enableProtections = ref(false);
const stakeAmountUnlimited = ref(false); const stakeAmountUnlimited = ref(false);
const allowCache = ref(true);
const maxOpenTrades = ref('');
const stakeAmount = ref('');
const startingCapital = ref('');
const btFormMode = ref('run'); const btFormMode = ref('run');
const pollInterval = ref<number | null>(null); const pollInterval = ref<number | null>(null);
@ -397,20 +394,20 @@ const clickBacktest = () => {
timerange: btStore.timerange, timerange: btStore.timerange,
enable_protections: enableProtections.value, enable_protections: enableProtections.value,
}; };
const openTradesInt = parseInt(maxOpenTrades.value, 10); const openTradesInt = parseInt(btStore.maxOpenTrades, 10);
if (openTradesInt) { if (openTradesInt) {
btPayload.max_open_trades = openTradesInt; btPayload.max_open_trades = openTradesInt;
} }
if (stakeAmountUnlimited.value) { if (stakeAmountUnlimited.value) {
btPayload.stake_amount = 'unlimited'; btPayload.stake_amount = 'unlimited';
} else { } else {
const stakeAmountLoc = Number(stakeAmount.value); const stakeAmountLoc = Number(btStore.stakeAmount);
if (stakeAmountLoc) { if (stakeAmountLoc) {
btPayload.stake_amount = stakeAmountLoc.toString(); btPayload.stake_amount = stakeAmountLoc.toString();
} }
} }
const startingCapitalLoc = Number(startingCapital.value); const startingCapitalLoc = Number(btStore.startingCapital);
if (startingCapitalLoc) { if (startingCapitalLoc) {
btPayload.dry_run_wallet = startingCapitalLoc; btPayload.dry_run_wallet = startingCapitalLoc;
} }
@ -421,7 +418,7 @@ const clickBacktest = () => {
if (btStore.selectedDetailTimeframe) { if (btStore.selectedDetailTimeframe) {
btPayload.timeframe_detail = btStore.selectedDetailTimeframe; btPayload.timeframe_detail = btStore.selectedDetailTimeframe;
} }
if (!allowCache.value) { if (!btStore.allowCache) {
btPayload.backtest_cache = 'none'; btPayload.backtest_cache = 'none';
} }
if (btStore.freqAI.enabled) { if (btStore.freqAI.enabled) {