mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-13 03:33:50 +00:00
Have backtesting show graph
This commit is contained in:
parent
bbbddee5f4
commit
870fd53d7b
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
<h2>Backtesting</h2>
|
||||||
<div class="row ml-1">
|
<div class="row ml-1">
|
||||||
<div class="col-mb-12">
|
<div class="col-mb-12">
|
||||||
<TimeRangeSelect v-model="timerange"></TimeRangeSelect>
|
<TimeRangeSelect v-model="timerange"></TimeRangeSelect>
|
||||||
|
@ -23,10 +24,28 @@
|
||||||
</b-button>
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="hasBacktestResult" class="text-center w-100 mt-5">
|
<div v-if="hasBacktestResult" class="text-center w-100 mt-5">
|
||||||
<BacktestResultView
|
<b-tabs content-class="mt-3" class="mt-3">
|
||||||
:strategy="strategy"
|
<b-tab title="Textbased Result" active>
|
||||||
:backtest-result="backtestResult.strategy ? backtestResult.strategy[strategy] : {}"
|
<BacktestResultView :strategy="strategy" :backtest-result="selectedBacktestResult" />
|
||||||
/>
|
</b-tab>
|
||||||
|
<b-tab title="Graph" lazy @click="clickGraphTab">
|
||||||
|
<b-form-select
|
||||||
|
v-model="pair"
|
||||||
|
:options="selectedBacktestResult.pairlist"
|
||||||
|
@change="clickGraphTab"
|
||||||
|
>
|
||||||
|
</b-form-select>
|
||||||
|
<CandleChart
|
||||||
|
:pair="pair"
|
||||||
|
:timeframe="timeframe"
|
||||||
|
:timeframems="timeframems"
|
||||||
|
:dataset="dataset"
|
||||||
|
:plot-config="selectedPlotConfig"
|
||||||
|
:trades="selectedBacktestResult.trades"
|
||||||
|
>
|
||||||
|
</CandleChart>
|
||||||
|
</b-tab>
|
||||||
|
</b-tabs>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -36,12 +55,21 @@ import { Component, Vue, Watch } from 'vue-property-decorator';
|
||||||
import { namespace } from 'vuex-class';
|
import { namespace } from 'vuex-class';
|
||||||
import TimeRangeSelect from '@/components/ftbot/TimeRangeSelect.vue';
|
import TimeRangeSelect from '@/components/ftbot/TimeRangeSelect.vue';
|
||||||
import BacktestResultView from '@/components/ftbot/BacktestResultView.vue';
|
import BacktestResultView from '@/components/ftbot/BacktestResultView.vue';
|
||||||
|
import CandleChart from '@/components/charts/CandleChart.vue';
|
||||||
|
|
||||||
import { BacktestPayload, BacktestResult } from '@/types';
|
import {
|
||||||
|
BacktestPayload,
|
||||||
|
BacktestResult,
|
||||||
|
PairHistoryPayload,
|
||||||
|
PlotConfig,
|
||||||
|
StrategyBacktestResult,
|
||||||
|
} from '@/types';
|
||||||
|
|
||||||
|
import { getCustomPlotConfig, getPlotConfigName } from '@/shared/storage';
|
||||||
|
|
||||||
const ftbot = namespace('ftbot');
|
const ftbot = namespace('ftbot');
|
||||||
@Component({
|
@Component({
|
||||||
components: { BacktestResultView, TimeRangeSelect },
|
components: { BacktestResultView, TimeRangeSelect, CandleChart },
|
||||||
})
|
})
|
||||||
export default class Backtesting extends Vue {
|
export default class Backtesting extends Vue {
|
||||||
pair = 'XRP/USDT';
|
pair = 'XRP/USDT';
|
||||||
|
@ -50,14 +78,21 @@ export default class Backtesting extends Vue {
|
||||||
|
|
||||||
timeframe = '5m';
|
timeframe = '5m';
|
||||||
|
|
||||||
|
timeframems = 300000;
|
||||||
|
|
||||||
strategy = 'BinHV45';
|
strategy = 'BinHV45';
|
||||||
|
|
||||||
timeframems = 300000;
|
selectedPlotConfig: PlotConfig = getCustomPlotConfig(getPlotConfigName());
|
||||||
|
|
||||||
@ftbot.State backtestRunning!: boolean;
|
@ftbot.State backtestRunning!: boolean;
|
||||||
|
|
||||||
@ftbot.State backtestResult!: BacktestResult;
|
@ftbot.State backtestResult!: BacktestResult;
|
||||||
|
|
||||||
|
@ftbot.State history;
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
@ftbot.Action public getPairHistory!: (payload: PairHistoryPayload) => void;
|
||||||
|
|
||||||
timerange = '';
|
timerange = '';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
@ -69,6 +104,14 @@ export default class Backtesting extends Vue {
|
||||||
return Object.keys(this.backtestResult).length !== 0;
|
return Object.keys(this.backtestResult).length !== 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get selectedBacktestResult(): StrategyBacktestResult {
|
||||||
|
return this.backtestResult.strategy[this.strategy] || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
get dataset() {
|
||||||
|
return this.history[`${this.pair}__${this.timeframe}`];
|
||||||
|
}
|
||||||
|
|
||||||
clickBacktest() {
|
clickBacktest() {
|
||||||
console.log('Backtesting');
|
console.log('Backtesting');
|
||||||
const btPayload: BacktestPayload = {
|
const btPayload: BacktestPayload = {
|
||||||
|
@ -78,6 +121,15 @@ export default class Backtesting extends Vue {
|
||||||
this.startBacktest(btPayload);
|
this.startBacktest(btPayload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clickGraphTab() {
|
||||||
|
this.getPairHistory({
|
||||||
|
pair: this.pair,
|
||||||
|
timeframe: this.timeframe,
|
||||||
|
timerange: this.timerange,
|
||||||
|
strategy: this.strategy,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Watch('backtestRunning')
|
@Watch('backtestRunning')
|
||||||
backtestRunningChanged() {
|
backtestRunningChanged() {
|
||||||
if (this.backtestRunning === true) {
|
if (this.backtestRunning === true) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user