mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-11 02:33:51 +00:00
Use accountbalance also for BalanceChart
This commit is contained in:
parent
f5c9fa0f79
commit
07ede302e1
|
@ -22,7 +22,7 @@ import {
|
|||
TooltipComponent,
|
||||
} from 'echarts/components';
|
||||
|
||||
import { BalanceRecords } from '@/types';
|
||||
import { BalanceValues } from '@/types';
|
||||
import { formatPriceCurrency } from '@/shared/formatters';
|
||||
import { computed } from 'vue';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
|
@ -38,7 +38,7 @@ use([
|
|||
]);
|
||||
|
||||
const props = defineProps({
|
||||
currencies: { required: true, type: Array as () => BalanceRecords[] },
|
||||
currencies: { required: true, type: Array as () => BalanceValues[] },
|
||||
showTitle: { required: false, type: Boolean },
|
||||
});
|
||||
const settingsStore = useSettingsStore();
|
||||
|
@ -53,16 +53,7 @@ const balanceChartOptions = computed((): EChartsOption => {
|
|||
backgroundColor: 'rgba(0, 0, 0, 0)',
|
||||
dataset: {
|
||||
dimensions: ['balance', 'currency', 'est_stake', 'free', 'used', 'stake'],
|
||||
source: props.currencies.map((currency) => {
|
||||
return {
|
||||
balance: currency.balance,
|
||||
currency: currency.currency,
|
||||
est_stake: currency.est_stake,
|
||||
free: currency.free,
|
||||
used: currency.used,
|
||||
stake: currency.stake,
|
||||
};
|
||||
}),
|
||||
source: props.currencies,
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
>
|
||||
</div>
|
||||
</div>
|
||||
<BalanceChart v-if="balanceCurrencies" :currencies="balanceCurrencies" />
|
||||
<BalanceChart v-if="balanceCurrencies" :currencies="chartValues" />
|
||||
<div>
|
||||
<p v-if="botStore.activeBot.balance.note">
|
||||
<strong>{{ botStore.activeBot.balance.note }}</strong>
|
||||
|
@ -67,6 +67,7 @@ import { formatPercent, formatPrice } from '@/shared/formatters';
|
|||
import { computed, ref } from 'vue';
|
||||
import { useBotStore } from '@/stores/ftbotwrapper';
|
||||
import { TableField } from 'bootstrap-vue-next';
|
||||
import { BalanceValues } from '@/types';
|
||||
|
||||
const botStore = useBotStore();
|
||||
const hideSmallBalances = ref(true);
|
||||
|
@ -92,6 +93,20 @@ const formatCurrency = (value) => {
|
|||
return value ? formatPrice(value, botStore.activeBot.stakeCurrencyDecimals) : '';
|
||||
};
|
||||
|
||||
const chartValues = computed<BalanceValues[]>(() => {
|
||||
return balanceCurrencies.value?.map((v) => {
|
||||
return {
|
||||
balance: v.balance,
|
||||
currency: v.currency,
|
||||
est_stake:
|
||||
showBotOnly.value && canUseBotBalance.value ? v.est_stake_bot ?? v.est_stake : v.est_stake,
|
||||
free: showBotOnly.value && canUseBotBalance.value ? v.bot_owned ?? v.free : v.free,
|
||||
used: v.used,
|
||||
stake: v.stake,
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
const tableFields = computed<TableField[]>(() => {
|
||||
return [
|
||||
{ key: 'currency', label: 'Currency' },
|
||||
|
|
|
@ -41,3 +41,13 @@ export interface BalanceInterface {
|
|||
starting_capital_fiat_ratio: number;
|
||||
starting_capital_fiat_pct: number;
|
||||
}
|
||||
|
||||
export interface BalanceValues {
|
||||
[key: string]: number | string;
|
||||
balance: number;
|
||||
currency: string;
|
||||
est_stake: number;
|
||||
free: number;
|
||||
used: number;
|
||||
stake: string;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user