Add total balance to botcomparison

This commit is contained in:
Matthias 2021-09-18 16:31:53 +02:00
parent 6b41f8fa8e
commit f3477d9edf
3 changed files with 20 additions and 1 deletions

View File

@ -24,6 +24,14 @@
:stake-currency="row.item.stakeCurrency" :stake-currency="row.item.stakeCurrency"
/> />
</template> </template>
<template #cell(balance)="row">
<div v-if="row.item.balance">
<span :title="row.item.stakeCurrency"
>{{ formatPrice(row.item.balance, row.item.stakeCurrencyDecimals) }}
</span>
<span clas="text-small">{{ row.item.stakeCurrency }}</span>
</div>
</template>
<template #cell(winVsLoss)="row"> <template #cell(winVsLoss)="row">
<div v-if="row.item.losses !== undefined"> <div v-if="row.item.losses !== undefined">
<span class="text-profit">{{ row.item.wins }}</span> / <span class="text-profit">{{ row.item.wins }}</span> /
@ -35,10 +43,11 @@
<script lang="ts"> <script lang="ts">
import { MultiBotStoreGetters } from '@/store/modules/botStoreWrapper'; import { MultiBotStoreGetters } from '@/store/modules/botStoreWrapper';
import { BotDescriptors, BotState, ProfitInterface } from '@/types'; import { BalanceInterface, BotDescriptors, BotState, ProfitInterface } from '@/types';
import { Component, Vue } from 'vue-property-decorator'; import { Component, Vue } from 'vue-property-decorator';
import { namespace } from 'vuex-class'; import { namespace } from 'vuex-class';
import ProfitPill from '@/components/general/ProfitPill.vue'; import ProfitPill from '@/components/general/ProfitPill.vue';
import { formatPrice } from '@/shared/formatters';
const ftbot = namespace('ftbot'); const ftbot = namespace('ftbot');
@ -50,8 +59,12 @@ export default class BotComparisonList extends Vue {
@ftbot.Getter [MultiBotStoreGetters.allBotState]!: Record<string, BotState>; @ftbot.Getter [MultiBotStoreGetters.allBotState]!: Record<string, BotState>;
@ftbot.Getter [MultiBotStoreGetters.allBalance]!: Record<string, BalanceInterface>;
@ftbot.Getter [MultiBotStoreGetters.allAvailableBots]!: BotDescriptors; @ftbot.Getter [MultiBotStoreGetters.allAvailableBots]!: BotDescriptors;
formatPrice = formatPrice;
get tableItems() { get tableItems() {
const val: any[] = []; const val: any[] = [];
const summary = { const summary = {
@ -77,6 +90,8 @@ export default class BotComparisonList extends Vue {
profitOpen: v.profit_all_coin - v.profit_closed_coin, profitOpen: v.profit_all_coin - v.profit_closed_coin,
wins: v.winning_trades, wins: v.winning_trades,
losses: v.losing_trades, losses: v.losing_trades,
balance: this.allBalance[k]?.total,
stakeCurrencyDecimals: this.allBotState[k]?.stake_currency_decimals || 3,
}); });
if (v.profit_closed_coin !== undefined) { if (v.profit_closed_coin !== undefined) {
summary.profitClosed += v.profit_closed_coin; summary.profitClosed += v.profit_closed_coin;
@ -95,6 +110,7 @@ export default class BotComparisonList extends Vue {
{ key: 'trades', label: 'Trades' }, { key: 'trades', label: 'Trades' },
{ key: 'profitOpen', label: 'Open Profit' }, { key: 'profitOpen', label: 'Open Profit' },
{ key: 'profitClosed', label: 'Closed Profit' }, { key: 'profitClosed', label: 'Closed Profit' },
{ key: 'balance', label: 'Balance' },
{ key: 'winVsLoss', label: 'W/L' }, { key: 'winVsLoss', label: 'W/L' },
]; ];
} }

View File

@ -30,6 +30,7 @@ export enum MultiBotStoreGetters {
allOpenTradeCount = 'allOpenTradeCount', allOpenTradeCount = 'allOpenTradeCount',
allClosedTrades = 'allClosedTrades', allClosedTrades = 'allClosedTrades',
allBotState = 'allBotState', allBotState = 'allBotState',
allBalance = 'allBalance',
} }
const createAllGetters = [ const createAllGetters = [
@ -41,6 +42,7 @@ const createAllGetters = [
'openTradeCount', 'openTradeCount',
'closedTrades', 'closedTrades',
'botState', 'botState',
'balance',
]; ];
export default function createBotStore(store) { export default function createBotStore(store) {

View File

@ -471,6 +471,7 @@ export function createBotSubStore(botId: string) {
updates.push(dispatch('getPerformance')); updates.push(dispatch('getPerformance'));
updates.push(dispatch('getProfit')); updates.push(dispatch('getProfit'));
updates.push(dispatch('getTrades')); updates.push(dispatch('getTrades'));
updates.push(dispatch('getBalance'));
/* white/blacklist might be refreshed more often as they are not expensive on the backend */ /* white/blacklist might be refreshed more often as they are not expensive on the backend */
updates.push(dispatch('getWhitelist')); updates.push(dispatch('getWhitelist'));
updates.push(dispatch('getBlacklist')); updates.push(dispatch('getBlacklist'));