frequi_origin/src/components/ftbot/DailyStats.vue

51 lines
1.3 KiB
Vue
Raw Normal View History

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>
2020-07-02 18:05:20 +00:00
<b-button class="float-right" size="sm" @click="getDaily">&#x21bb;</b-button>
</div>
2020-05-22 18:04:27 +00:00
<div>
2020-08-31 15:43:44 +00:00
<DailyChart v-if="dailyStats.data" :daily-stats="dailyStats" />
</div>
2020-06-11 18:24:17 +00:00
<div>
<b-table class="table-sm" :items="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">
import Vue from 'vue';
2021-09-18 17:45:26 +00:00
import { mapActions, mapGetters } from 'vuex';
import DailyChart from '@/components/charts/DailyChart.vue';
2021-02-03 06:53:38 +00:00
import { formatPrice } from '@/shared/formatters';
2021-09-18 17:45:26 +00:00
import { BotStoreGetters } from '@/store/modules/ftbot';
2020-05-17 18:43:19 +00:00
2020-10-25 09:35:19 +00:00
export default Vue.extend({
2020-05-17 18:43:19 +00:00
name: 'DailyStats',
2020-06-11 18:24:17 +00:00
components: {
DailyChart,
2020-06-11 18:24:17 +00:00
},
2020-05-17 18:43:19 +00:00
computed: {
2021-09-18 17:45:26 +00:00
...mapGetters('ftbot', [BotStoreGetters.dailyStats]),
2020-06-04 18:06:58 +00:00
dailyFields() {
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',
label: `In ${this.dailyStats.fiat_display_currency}`,
formatter: (value) => formatPrice(value, 2),
},
2020-05-17 18:43:19 +00:00
{ key: 'trade_count', label: 'Trades' },
];
},
},
mounted() {
this.getDaily();
},
2020-09-04 15:08:02 +00:00
methods: {
...mapActions('ftbot', ['getDaily']),
},
2020-10-25 09:35:19 +00:00
});
2020-05-17 18:43:19 +00:00
</script>