mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-10 10:21:55 +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">
|
||||
<BotStatus />
|
||||
</b-tab>
|
||||
<b-tab title="Balance">
|
||||
<Balance />
|
||||
</b-tab>
|
||||
<b-tab title="Whitelist"> </b-tab>
|
||||
</b-tabs>
|
||||
</div>
|
||||
|
@ -49,10 +52,11 @@ import TradeList from './TradeList.vue';
|
|||
import Performance from './Performance.vue';
|
||||
import BotControls from './BotControls.vue';
|
||||
import BotStatus from './BotStatus.vue';
|
||||
import Balance from './Balance.vue';
|
||||
|
||||
export default {
|
||||
name: 'TradeView',
|
||||
components: { TradeList, Performance, BotControls, BotStatus },
|
||||
components: { TradeList, Performance, BotControls, BotStatus, Balance },
|
||||
created() {
|
||||
this.getTrades();
|
||||
this.getProfit();
|
||||
|
|
|
@ -41,6 +41,7 @@ export default new Vuex.Store({
|
|||
dispatch('ftbot/getWhitelist');
|
||||
dispatch('ftbot/getBlacklist');
|
||||
dispatch('ftbot/getProfit');
|
||||
dispatch('ftbot/getBalance');
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -13,6 +13,7 @@ export default {
|
|||
blacklist: [],
|
||||
profit: {},
|
||||
botState: {},
|
||||
balance: {}
|
||||
},
|
||||
getters: {
|
||||
apiAuth(state, getters, rootState, rootGetters) {
|
||||
|
@ -46,6 +47,9 @@ export default {
|
|||
updateProfit(state, profit) {
|
||||
state.profit = profit;
|
||||
},
|
||||
updateBalance(state, balance) {
|
||||
state.balance = balance;
|
||||
},
|
||||
updateState(state, botState) {
|
||||
state.botState = botState;
|
||||
},
|
||||
|
@ -93,6 +97,13 @@ export default {
|
|||
.then((result) => commit('updateProfit', result.data))
|
||||
.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 }) {
|
||||
return axios.get(`${apiBase}/show_config`, {
|
||||
...getters.apiAuth
|
||||
|
|
Loading…
Reference in New Issue
Block a user