Show freqtrade bot version

This commit is contained in:
Matthias 2020-05-25 20:41:17 +02:00
parent 303b036d89
commit 0a20b69dda
4 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,8 @@
<template>
<div>
<p>
Running Freqtrade <strong>{{ version }}</strong>
</p>
<p v-if="profit.profit_all_coin">
Avg Profit {{ profit.profit_all_coin.toFixed(2) }}% in {{ profit.trade_count }} Trades, with
an average duration of {{ profit.avg_duration }}. Best pair: {{ profit.best_pair }}.
@ -36,7 +39,7 @@ import { mapState } from 'vuex';
export default {
name: 'BotStatus',
computed: {
...mapState('ftbot', ['profit', 'botState']),
...mapState('ftbot', ['version', 'profit', 'botState']),
},
methods: {
formatTimestamp(timestamp) {

View File

@ -22,6 +22,9 @@ export default new Vuex.Store({
},
},
actions: {
refreshOnce({ dispatch }) {
dispatch('ftbot/getVersion');
},
refreshAll({ dispatch }) {
dispatch('refreshFrequent');
dispatch('refreshSlow');

View File

@ -3,6 +3,7 @@ import { api } from '@/shared/apiService';
export default {
namespaced: true,
state: {
version: '',
trades: [],
openTrades: [],
trade_count: 0,
@ -54,6 +55,9 @@ export default {
updateState(state, botState) {
state.botState = botState;
},
updateVersion(state, version) {
state.version = version.version;
},
},
actions: {
ping({ commit }) {
@ -117,6 +121,12 @@ export default {
.then((result) => commit('updateState', result.data))
.catch(console.error);
},
getVersion({ commit }) {
return api
.get('/version')
.then((result) => commit('updateVersion', result.data))
.catch(console.error);
},
// Post methods
// TODO: Migrate calls to API to a seperate module unrelated to vuex?
startBot() {

View File

@ -75,6 +75,7 @@ export default {
FTBotAPIPairList,
},
created() {
this.refreshOnce();
this.refreshAll();
},
data() {
@ -89,7 +90,7 @@ export default {
...mapGetters('ftbot', ['openTrades', 'closedtrades']),
},
methods: {
...mapActions(['refreshSlow', 'refreshFrequent', 'refreshAll']),
...mapActions(['refreshSlow', 'refreshFrequent', 'refreshAll', 'refreshOnce']),
// ...mapActions('ftbot', ['getTrades', 'getProfit', 'getState']),
startRefresh() {
console.log('Starting automatic refresh.');