mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-11 02:33:51 +00:00
Extract history-load to separate component
This commit is contained in:
parent
bb21744232
commit
bef7202554
61
src/components/ftbot/BacktestHistoryLoad.vue
Normal file
61
src/components/ftbot/BacktestHistoryLoad.vue
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="btn btn-secondary float-right"
|
||||||
|
title="Refresh"
|
||||||
|
aria-label="Refresh"
|
||||||
|
@click="getBacktestHistory"
|
||||||
|
>
|
||||||
|
↻
|
||||||
|
</button>
|
||||||
|
<p>
|
||||||
|
Load Historic results from disk. You can click on multiple results to load all of them into
|
||||||
|
freqUI.
|
||||||
|
</p>
|
||||||
|
<b-list-group v-if="backtestHistoryList" class="ml-2">
|
||||||
|
<b-list-group-item
|
||||||
|
v-for="(res, idx) in backtestHistoryList"
|
||||||
|
:key="idx"
|
||||||
|
class="d-flex justify-content-between align-items-center py-1 mb-1"
|
||||||
|
button
|
||||||
|
@click="getBacktestHistoryResult(res.filename)"
|
||||||
|
>
|
||||||
|
<strong>{{ res.strategy }}</strong>
|
||||||
|
backtested on: {{ timestampms(res.backtest_start_time * 1000) }}
|
||||||
|
<small>{{ res.filename }}</small>
|
||||||
|
</b-list-group-item>
|
||||||
|
</b-list-group>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { defineComponent, onMounted } from '@vue/composition-api';
|
||||||
|
import StoreModules from '@/store/storeSubModules';
|
||||||
|
import { useNamespacedActions, useNamespacedGetters } from 'vuex-composition-helpers';
|
||||||
|
import { timestampms } from '@/shared/formatters';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
setup() {
|
||||||
|
const { getBacktestHistory, getBacktestHistoryResult } = useNamespacedActions(
|
||||||
|
StoreModules.ftbot,
|
||||||
|
['getBacktestHistory', 'getBacktestHistoryResult'],
|
||||||
|
);
|
||||||
|
const { backtestHistoryList } = useNamespacedGetters(StoreModules.ftbot, [
|
||||||
|
'backtestHistoryList',
|
||||||
|
]);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getBacktestHistory();
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
getBacktestHistory,
|
||||||
|
getBacktestHistoryResult,
|
||||||
|
backtestHistoryList,
|
||||||
|
timestampms,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
|
@ -8,6 +8,15 @@
|
||||||
<div
|
<div
|
||||||
class="col-12 col-lg-order-last col-lg-6 mx-md-5 d-flex flex-wrap justify-content-md-center justify-content-between mb-4"
|
class="col-12 col-lg-order-last col-lg-6 mx-md-5 d-flex flex-wrap justify-content-md-center justify-content-between mb-4"
|
||||||
:disabled="canRunBacktest"
|
:disabled="canRunBacktest"
|
||||||
|
>
|
||||||
|
<b-form-radio
|
||||||
|
v-model="btFormMode"
|
||||||
|
name="bt-form-radios"
|
||||||
|
button
|
||||||
|
class="mx-1 flex-samesize-items"
|
||||||
|
value="historicResults"
|
||||||
|
:disabled="!canRunBacktest"
|
||||||
|
>Load Results</b-form-radio
|
||||||
>
|
>
|
||||||
<b-form-radio
|
<b-form-radio
|
||||||
v-model="btFormMode"
|
v-model="btFormMode"
|
||||||
|
@ -75,17 +84,13 @@
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
<!-- End Left bar -->
|
<!-- End Left bar -->
|
||||||
|
<div
|
||||||
|
v-if="btFormMode == 'historicResults'"
|
||||||
|
class="flex-fill row d-flex flex-column bt-config"
|
||||||
|
>
|
||||||
|
<backtest-history-load />
|
||||||
|
</div>
|
||||||
<div v-if="btFormMode == 'run'" class="flex-fill row d-flex flex-column bt-config">
|
<div v-if="btFormMode == 'run'" class="flex-fill row d-flex flex-column bt-config">
|
||||||
<button class="btn btn-secondary" @click="getBacktestHistory">Get historic results</button>
|
|
||||||
<div v-if="backtestHistoryList">
|
|
||||||
<div v-for="(res, idx) in backtestHistoryList" :key="idx">
|
|
||||||
<button class="btn btn-secondary" @click="getBacktestHistoryResult(res.filename)">
|
|
||||||
{{ res.filename }} {{ res.strategy }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
<span>Strategy</span>
|
<span>Strategy</span>
|
||||||
<StrategySelect v-model="strategy"></StrategySelect>
|
<StrategySelect v-model="strategy"></StrategySelect>
|
||||||
|
@ -308,6 +313,7 @@ import TradesLogChart from '@/components/charts/TradesLog.vue';
|
||||||
import PairSummary from '@/components/ftbot/PairSummary.vue';
|
import PairSummary from '@/components/ftbot/PairSummary.vue';
|
||||||
import TimeframeSelect from '@/components/ftbot/TimeframeSelect.vue';
|
import TimeframeSelect from '@/components/ftbot/TimeframeSelect.vue';
|
||||||
import TradeList from '@/components/ftbot/TradeList.vue';
|
import TradeList from '@/components/ftbot/TradeList.vue';
|
||||||
|
import BacktestHistoryLoad from '@/components/ftbot/BacktestHistoryLoad.vue';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BacktestPayload,
|
BacktestPayload,
|
||||||
|
@ -317,7 +323,6 @@ import {
|
||||||
PairHistoryPayload,
|
PairHistoryPayload,
|
||||||
PlotConfig,
|
PlotConfig,
|
||||||
StrategyBacktestResult,
|
StrategyBacktestResult,
|
||||||
BacktestHistoryEntry,
|
|
||||||
} from '@/types';
|
} from '@/types';
|
||||||
|
|
||||||
import { getCustomPlotConfig, getPlotConfigName } from '@/shared/storage';
|
import { getCustomPlotConfig, getPlotConfigName } from '@/shared/storage';
|
||||||
|
@ -330,6 +335,7 @@ const ftbot = namespace(StoreModules.ftbot);
|
||||||
components: {
|
components: {
|
||||||
BacktestResultView,
|
BacktestResultView,
|
||||||
BacktestResultSelect,
|
BacktestResultSelect,
|
||||||
|
BacktestHistoryLoad,
|
||||||
TimeRangeSelect,
|
TimeRangeSelect,
|
||||||
CandleChartContainer,
|
CandleChartContainer,
|
||||||
CumProfitChart,
|
CumProfitChart,
|
||||||
|
@ -386,8 +392,6 @@ export default class Backtesting extends Vue {
|
||||||
|
|
||||||
@ftbot.Getter [BotStoreGetters.canRunBacktest]!: boolean;
|
@ftbot.Getter [BotStoreGetters.canRunBacktest]!: boolean;
|
||||||
|
|
||||||
@ftbot.Getter [BotStoreGetters.backtestHistoryList]!: BacktestHistoryEntry[];
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
@ftbot.Action getPairHistory!: (payload: PairHistoryPayload) => void;
|
@ftbot.Action getPairHistory!: (payload: PairHistoryPayload) => void;
|
||||||
|
|
||||||
|
@ -404,9 +408,6 @@ export default class Backtesting extends Vue {
|
||||||
|
|
||||||
@ftbot.Action stopBacktest!: () => void;
|
@ftbot.Action stopBacktest!: () => void;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
@ftbot.Action getBacktestHistoryResult!: (filename: string) => void;
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
@ftbot.Action setBacktestResultKey!: (key: string) => void;
|
@ftbot.Action setBacktestResultKey!: (key: string) => void;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user