2020-05-17 18:43:19 +00:00
|
|
|
<template>
|
2020-05-22 18:04:27 +00:00
|
|
|
<div>
|
|
|
|
<div class="mb-2">
|
|
|
|
<label class="mr-auto h3">Daily Stats</label>
|
2022-04-19 04:33:25 +00:00
|
|
|
<b-button class="float-right" size="sm" @click="botStore.activeBot.getDaily"
|
|
|
|
>↻</b-button
|
|
|
|
>
|
2020-05-17 18:52:14 +00:00
|
|
|
</div>
|
2020-05-22 18:04:27 +00:00
|
|
|
<div>
|
2022-04-19 04:33:25 +00:00
|
|
|
<DailyChart
|
|
|
|
v-if="botStore.activeBot.dailyStats.data"
|
2022-09-27 16:11:58 +00:00
|
|
|
:daily-stats="botStore.activeBot.dailyStatsSorted"
|
2022-04-19 04:33:25 +00:00
|
|
|
/>
|
2020-05-17 18:52:14 +00:00
|
|
|
</div>
|
2020-06-11 18:24:17 +00:00
|
|
|
<div>
|
2022-04-19 04:33:25 +00:00
|
|
|
<b-table class="table-sm" :items="botStore.activeBot.dailyStats.data" :fields="dailyFields">
|
|
|
|
</b-table>
|
2020-06-11 18:24:17 +00:00
|
|
|
</div>
|
2020-05-17 18:43:19 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2020-10-25 09:35:19 +00:00
|
|
|
<script lang="ts">
|
2022-07-07 18:44:19 +00:00
|
|
|
import { defineComponent, computed, onMounted } from 'vue';
|
2020-08-17 18:39:14 +00:00
|
|
|
import DailyChart from '@/components/charts/DailyChart.vue';
|
2022-06-11 09:40:20 +00:00
|
|
|
import { formatPercent, formatPrice } from '@/shared/formatters';
|
2022-04-19 04:33:25 +00:00
|
|
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
2020-05-17 18:43:19 +00:00
|
|
|
|
2022-04-17 08:01:15 +00:00
|
|
|
export default defineComponent({
|
2020-05-17 18:43:19 +00:00
|
|
|
name: 'DailyStats',
|
2020-06-11 18:24:17 +00:00
|
|
|
components: {
|
2020-08-17 18:39:14 +00:00
|
|
|
DailyChart,
|
2020-06-11 18:24:17 +00:00
|
|
|
},
|
2022-04-17 08:01:15 +00:00
|
|
|
setup() {
|
2022-04-19 04:33:25 +00:00
|
|
|
const botStore = useBotStore();
|
2022-04-17 08:01:15 +00:00
|
|
|
const dailyFields = computed(() => {
|
2020-05-17 18:43:19 +00:00
|
|
|
return [
|
|
|
|
{ key: 'date', label: 'Day' },
|
2021-02-03 06:53:38 +00:00
|
|
|
{ key: 'abs_profit', label: 'Profit', formatter: (value) => formatPrice(value) },
|
|
|
|
{
|
|
|
|
key: 'fiat_value',
|
2022-04-19 04:33:25 +00:00
|
|
|
label: `In ${botStore.activeBot.dailyStats.fiat_display_currency}`,
|
2021-02-03 06:53:38 +00:00
|
|
|
formatter: (value) => formatPrice(value, 2),
|
|
|
|
},
|
2020-05-17 18:43:19 +00:00
|
|
|
{ key: 'trade_count', label: 'Trades' },
|
2022-06-11 09:40:20 +00:00
|
|
|
botStore.activeBot.botApiVersion >= 2.16
|
|
|
|
? { key: 'rel_profit', label: 'Profit%', formatter: (value) => formatPercent(value, 2) }
|
|
|
|
: null,
|
2020-05-17 18:43:19 +00:00
|
|
|
];
|
2022-04-17 08:01:15 +00:00
|
|
|
});
|
|
|
|
onMounted(() => {
|
2022-04-19 04:33:25 +00:00
|
|
|
botStore.activeBot.getDaily();
|
2022-04-17 08:01:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
2022-04-19 04:33:25 +00:00
|
|
|
botStore,
|
2022-04-17 08:01:15 +00:00
|
|
|
dailyFields,
|
|
|
|
};
|
2020-09-04 15:08:02 +00:00
|
|
|
},
|
2020-10-25 09:35:19 +00:00
|
|
|
});
|
2020-05-17 18:43:19 +00:00
|
|
|
</script>
|