mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 11:35:14 +00:00
Add strategy list
This commit is contained in:
parent
3a6786b39d
commit
81972b3a52
45
src/components/ftbot/StrategyList.vue
Normal file
45
src/components/ftbot/StrategyList.vue
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<template>
|
||||||
|
<b-form-group label="Strategy" label-for="strategyName" invalid-feedback="Strategy is required">
|
||||||
|
<b-form-select :options="strategyList" v-model="strategy" @change="strategyChanged">
|
||||||
|
</b-form-select>
|
||||||
|
</b-form-group>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Vue, Prop, Emit } from 'vue-property-decorator';
|
||||||
|
import { namespace } from 'vuex-class';
|
||||||
|
|
||||||
|
const ftbot = namespace('ftbot');
|
||||||
|
|
||||||
|
@Component({})
|
||||||
|
export default class StrategyList extends Vue {
|
||||||
|
@Prop() value!: string;
|
||||||
|
|
||||||
|
@ftbot.Action getStrategyList;
|
||||||
|
|
||||||
|
@ftbot.State strategyList;
|
||||||
|
|
||||||
|
@Emit('input')
|
||||||
|
emitStrategy(strategy: string) {
|
||||||
|
return strategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
get strategy() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set strategy(val) {
|
||||||
|
this.emitStrategy(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
strategyChanged(newVal) {
|
||||||
|
this.value = newVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.getStrategyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
|
@ -42,6 +42,7 @@ export default {
|
||||||
history: {},
|
history: {},
|
||||||
strategyPlotConfig: {},
|
strategyPlotConfig: {},
|
||||||
customPlotConfig: { ...EMPTY_PLOTCONFIG },
|
customPlotConfig: { ...EMPTY_PLOTCONFIG },
|
||||||
|
strategyList: [],
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
[BotStoreGetters.openTrades](state) {
|
[BotStoreGetters.openTrades](state) {
|
||||||
|
@ -97,6 +98,9 @@ export default {
|
||||||
setDetailTrade(state, trade: Trade) {
|
setDetailTrade(state, trade: Trade) {
|
||||||
state.detailTradeId = trade ? trade.trade_id : null;
|
state.detailTradeId = trade ? trade.trade_id : null;
|
||||||
},
|
},
|
||||||
|
updateStrategyList(state, list) {
|
||||||
|
state.strategyList = list;
|
||||||
|
},
|
||||||
updatePairCandles(state, { pair, timeframe, data }) {
|
updatePairCandles(state, { pair, timeframe, data }) {
|
||||||
state.candleData = { ...state.candleData, [`${pair}__${timeframe}`]: data };
|
state.candleData = { ...state.candleData, [`${pair}__${timeframe}`]: data };
|
||||||
},
|
},
|
||||||
|
@ -191,6 +195,12 @@ export default {
|
||||||
.then((result) => commit('updatePlotConfig', result.data))
|
.then((result) => commit('updatePlotConfig', result.data))
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
},
|
},
|
||||||
|
getStrategyList({ commit }) {
|
||||||
|
return api
|
||||||
|
.get('/strategies')
|
||||||
|
.then((result) => commit('updateStrategyList', result.data))
|
||||||
|
.catch(console.error);
|
||||||
|
},
|
||||||
getPerformance({ commit }) {
|
getPerformance({ commit }) {
|
||||||
return api
|
return api
|
||||||
.get('/performance')
|
.get('/performance')
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2" v-if="historicView">
|
<div class="mt-2" v-if="historicView">
|
||||||
<TimeRangeSelect v-model="timerange"></TimeRangeSelect>
|
<TimeRangeSelect v-model="timerange"></TimeRangeSelect>
|
||||||
|
<StrategyList v-model="strategy"></StrategyList>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -33,11 +34,13 @@ import { Component, Vue } from 'vue-property-decorator';
|
||||||
import { namespace } from 'vuex-class';
|
import { namespace } from 'vuex-class';
|
||||||
import CandleChart from '@/components/ftbot/CandleChart.vue';
|
import CandleChart from '@/components/ftbot/CandleChart.vue';
|
||||||
import TimeRangeSelect from '@/components/ftbot/TimeRangeSelect.vue';
|
import TimeRangeSelect from '@/components/ftbot/TimeRangeSelect.vue';
|
||||||
|
import StrategyList from '@/components/ftbot/StrategyList.vue';
|
||||||
import { PairCandlePayload, PairHistoryPayload } from '@/store/types';
|
import { PairCandlePayload, PairHistoryPayload } from '@/store/types';
|
||||||
|
|
||||||
const ftbot = namespace('ftbot');
|
const ftbot = namespace('ftbot');
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: { CandleChart, TimeRangeSelect },
|
components: { CandleChart, StrategyList, TimeRangeSelect },
|
||||||
})
|
})
|
||||||
export default class Graphs extends Vue {
|
export default class Graphs extends Vue {
|
||||||
pair = 'XRP/USDT';
|
pair = 'XRP/USDT';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user