mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-26 21:15:15 +00:00
Store backtest step + progress
This commit is contained in:
parent
823e144bcb
commit
019d368b41
|
@ -24,6 +24,7 @@ import {
|
|||
RunModes,
|
||||
TradeResponse,
|
||||
StrategyBacktestResult,
|
||||
BacktestStatus,
|
||||
} from '@/types';
|
||||
|
||||
import {
|
||||
|
@ -195,8 +196,11 @@ export default {
|
|||
storeCustomPlotConfig(plotConfig);
|
||||
state.availablePlotConfigNames = getAllPlotConfigNames();
|
||||
},
|
||||
updateBacktestRunning(state: FtbotStateType, running: boolean) {
|
||||
state.backtestRunning = running;
|
||||
updateBacktestRunning(state: FtbotStateType, backtestStatus: BacktestStatus) {
|
||||
state.backtestRunning = backtestStatus.running;
|
||||
state.backtestProgress = backtestStatus.progress;
|
||||
state.backtestStep = backtestStatus.step;
|
||||
state.backtestTradeCount = backtestStatus.trade_count || 0;
|
||||
},
|
||||
updateBacktestResult(state, backtestResult: BacktestResult) {
|
||||
state.backtestResult = backtestResult;
|
||||
|
@ -602,14 +606,14 @@ export default {
|
|||
async startBacktest({ commit }, payload) {
|
||||
try {
|
||||
const result = await api.post('/backtest', payload);
|
||||
commit('updateBacktestRunning', result.data.running);
|
||||
commit('updateBacktestRunning', result.data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
async pollBacktest({ commit }) {
|
||||
const result = await api.get('/backtest');
|
||||
commit('updateBacktestRunning', result.data.running);
|
||||
commit('updateBacktestRunning', result.data);
|
||||
if (result.data.running === false && result.data.backtest_result) {
|
||||
commit('updateBacktestResult', result.data.backtest_result);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
ProfitInterface,
|
||||
BacktestResult,
|
||||
StrategyBacktestResult,
|
||||
BacktestSteps,
|
||||
} from '@/types';
|
||||
|
||||
export interface FtbotStateType {
|
||||
|
@ -44,10 +45,14 @@ export interface FtbotStateType {
|
|||
pairlist: string[];
|
||||
currentLocks?: LockResponse;
|
||||
backtestRunning: boolean;
|
||||
backtestProgress: number;
|
||||
backtestStep: BacktestSteps;
|
||||
backtestTradeCount: number;
|
||||
backtestResult?: BacktestResult;
|
||||
selectedBacktestResultKey: string;
|
||||
backtestHistory: Record<string, StrategyBacktestResult>;
|
||||
}
|
||||
|
||||
const state: FtbotStateType = {
|
||||
version: '',
|
||||
lastLogs: [],
|
||||
|
@ -77,6 +82,9 @@ const state: FtbotStateType = {
|
|||
currentLocks: undefined,
|
||||
// backtesting
|
||||
backtestRunning: false,
|
||||
backtestProgress: 0.0,
|
||||
backtestStep: BacktestSteps.none,
|
||||
backtestTradeCount: 0,
|
||||
backtestResult: undefined,
|
||||
selectedBacktestResultKey: '',
|
||||
backtestHistory: {},
|
||||
|
|
|
@ -124,3 +124,22 @@ export interface BacktestResult {
|
|||
strategy: Record<string, StrategyBacktestResult>;
|
||||
strategy_comparison: Array<Record<string, string | number>>;
|
||||
}
|
||||
|
||||
export enum BacktestSteps {
|
||||
startup,
|
||||
dataload,
|
||||
analyze,
|
||||
convert,
|
||||
backtest,
|
||||
none = '',
|
||||
}
|
||||
|
||||
export interface BacktestStatus {
|
||||
status: string;
|
||||
running: boolean;
|
||||
status_msg: string;
|
||||
step: BacktestSteps;
|
||||
progress: number;
|
||||
trade_count?: number;
|
||||
backtest_result?: BacktestResult;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
<div class="container-fluid">
|
||||
<div class="mb-2">
|
||||
<h2 class="mt-3 d-inline">Backtesting</h2>
|
||||
<small v-show="backtestRunning" class="bt-running-label">Backtest running</small>
|
||||
<small v-show="backtestRunning" class="bt-running-label"
|
||||
>Backtest running: {{ backtestStep }} {{ formatPercent(backtestProgress) }}</small
|
||||
>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row mx-5 d-flex flex-wrap justify-content-center mb-4">
|
||||
|
@ -296,7 +298,7 @@ export default class Backtesting extends Vue {
|
|||
'1y',
|
||||
];
|
||||
|
||||
showLeftBar = true;
|
||||
showLeftBar = false;
|
||||
|
||||
selectedTimeframe = '';
|
||||
|
||||
|
@ -320,6 +322,10 @@ export default class Backtesting extends Vue {
|
|||
|
||||
@ftbot.State backtestRunning!: boolean;
|
||||
|
||||
@ftbot.State backtestStep!: string;
|
||||
|
||||
@ftbot.State backtestProgress!: number;
|
||||
|
||||
@ftbot.State backtestHistory!: StrategyBacktestResult[];
|
||||
|
||||
@ftbot.State selectedBacktestResultKey!: string;
|
||||
|
|
Loading…
Reference in New Issue
Block a user