mirror of
https://github.com/freqtrade/frequi.git
synced 2024-09-20 09:31:10 +00:00
Add balance view
This commit is contained in:
parent
8f26cff24b
commit
5fdad10b83
38
src/ftbot/Balance.vue
Normal file
38
src/ftbot/Balance.vue
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<template>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">Balance</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<b-table class="table-sm" :items="balance.currencies" :fields="table_fields">
|
||||||
|
<template slot="bottom-row">
|
||||||
|
<td>Total</td>
|
||||||
|
<td></td>
|
||||||
|
<!-- this is a computed prop that adds up all the expenses in the visible rows -->
|
||||||
|
<td>{{ formatCurrency(balance.total) }}</td>
|
||||||
|
</template>
|
||||||
|
</b-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState } from 'vuex';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Balance',
|
||||||
|
computed: {
|
||||||
|
...mapState('ftbot', ['balance']),
|
||||||
|
table_fields() {
|
||||||
|
return [
|
||||||
|
{ key: 'currency', label: 'Currency' },
|
||||||
|
{ key: 'free', label: 'Available', formatter: 'formatCurrency' },
|
||||||
|
{ key: 'est_stake', label: `in ${this.balance.stake}`, formatter: 'formatCurrency' },
|
||||||
|
];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatCurrency(value) {
|
||||||
|
return value.toFixed(5);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -32,6 +32,9 @@
|
||||||
<b-tab title="Status">
|
<b-tab title="Status">
|
||||||
<BotStatus />
|
<BotStatus />
|
||||||
</b-tab>
|
</b-tab>
|
||||||
|
<b-tab title="Balance">
|
||||||
|
<Balance />
|
||||||
|
</b-tab>
|
||||||
<b-tab title="Whitelist"> </b-tab>
|
<b-tab title="Whitelist"> </b-tab>
|
||||||
</b-tabs>
|
</b-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,10 +52,11 @@ import TradeList from './TradeList.vue';
|
||||||
import Performance from './Performance.vue';
|
import Performance from './Performance.vue';
|
||||||
import BotControls from './BotControls.vue';
|
import BotControls from './BotControls.vue';
|
||||||
import BotStatus from './BotStatus.vue';
|
import BotStatus from './BotStatus.vue';
|
||||||
|
import Balance from './Balance.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TradeView',
|
name: 'TradeView',
|
||||||
components: { TradeList, Performance, BotControls, BotStatus },
|
components: { TradeList, Performance, BotControls, BotStatus, Balance },
|
||||||
created() {
|
created() {
|
||||||
this.getTrades();
|
this.getTrades();
|
||||||
this.getProfit();
|
this.getProfit();
|
||||||
|
|
|
@ -41,6 +41,7 @@ export default new Vuex.Store({
|
||||||
dispatch('ftbot/getWhitelist');
|
dispatch('ftbot/getWhitelist');
|
||||||
dispatch('ftbot/getBlacklist');
|
dispatch('ftbot/getBlacklist');
|
||||||
dispatch('ftbot/getProfit');
|
dispatch('ftbot/getProfit');
|
||||||
|
dispatch('ftbot/getBalance');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -13,6 +13,7 @@ export default {
|
||||||
blacklist: [],
|
blacklist: [],
|
||||||
profit: {},
|
profit: {},
|
||||||
botState: {},
|
botState: {},
|
||||||
|
balance: {}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
apiAuth(state, getters, rootState, rootGetters) {
|
apiAuth(state, getters, rootState, rootGetters) {
|
||||||
|
@ -46,6 +47,9 @@ export default {
|
||||||
updateProfit(state, profit) {
|
updateProfit(state, profit) {
|
||||||
state.profit = profit;
|
state.profit = profit;
|
||||||
},
|
},
|
||||||
|
updateBalance(state, balance) {
|
||||||
|
state.balance = balance;
|
||||||
|
},
|
||||||
updateState(state, botState) {
|
updateState(state, botState) {
|
||||||
state.botState = botState;
|
state.botState = botState;
|
||||||
},
|
},
|
||||||
|
@ -93,6 +97,13 @@ export default {
|
||||||
.then((result) => commit('updateProfit', result.data))
|
.then((result) => commit('updateProfit', result.data))
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
},
|
},
|
||||||
|
getBalance({ commit, getters }) {
|
||||||
|
return axios.get(`${apiBase}/balance`, {
|
||||||
|
...getters.apiAuth
|
||||||
|
})
|
||||||
|
.then((result) => commit('updateBalance', result.data))
|
||||||
|
.catch(console.error);
|
||||||
|
},
|
||||||
getState({ commit, getters, dispatch }) {
|
getState({ commit, getters, dispatch }) {
|
||||||
return axios.get(`${apiBase}/show_config`, {
|
return axios.get(`${apiBase}/show_config`, {
|
||||||
...getters.apiAuth
|
...getters.apiAuth
|
||||||
|
|
Loading…
Reference in New Issue
Block a user