Add daily % metric to daily stats

This commit is contained in:
Matthias 2022-06-11 11:40:20 +02:00
parent d7896604d8
commit f83524a8ba
2 changed files with 8 additions and 2 deletions

View File

@ -22,7 +22,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, computed, onMounted } from '@vue/composition-api'; import { defineComponent, computed, onMounted } from '@vue/composition-api';
import DailyChart from '@/components/charts/DailyChart.vue'; import DailyChart from '@/components/charts/DailyChart.vue';
import { formatPrice } from '@/shared/formatters'; import { formatPercent, formatPrice } from '@/shared/formatters';
import { useBotStore } from '@/stores/ftbotwrapper'; import { useBotStore } from '@/stores/ftbotwrapper';
export default defineComponent({ export default defineComponent({
@ -42,6 +42,9 @@ export default defineComponent({
formatter: (value) => formatPrice(value, 2), formatter: (value) => formatPrice(value, 2),
}, },
{ key: 'trade_count', label: 'Trades' }, { key: 'trade_count', label: 'Trades' },
botStore.activeBot.botApiVersion >= 2.16
? { key: 'rel_profit', label: 'Profit%', formatter: (value) => formatPercent(value, 2) }
: null,
]; ];
}); });
onMounted(() => { onMounted(() => {

View File

@ -4,9 +4,12 @@ export interface DailyPayload {
export interface DailyRecord { export interface DailyRecord {
/** Date in the format yyyy-mm-dd */ /** Date in the format yyyy-mm-dd */
[key: string]: string | number; [key: string]: string | number | undefined;
date: string; date: string;
abs_profit: number; abs_profit: number;
/** added in 2.16*/
rel_profit?: number;
starting_balance_profit?: number;
fiat_value: number; fiat_value: number;
trade_count: number; trade_count: number;
} }