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">↻</b-button>
|
2020-05-17 18:52:14 +00:00
|
|
|
</div>
|
2020-05-22 18:04:27 +00:00
|
|
|
<div>
|
2020-06-12 05:17:48 +00:00
|
|
|
<v-chart v-if="dailyStats.data" :options="dailyChart" />
|
2020-05-17 18:52:14 +00:00
|
|
|
</div>
|
2020-06-11 18:24:17 +00:00
|
|
|
<div>
|
2020-06-11 18:25:44 +00:00
|
|
|
<b-table class="table-sm" :items="dailyStats.data" :fields="daily_fields"> </b-table>
|
2020-06-11 18:24:17 +00:00
|
|
|
</div>
|
2020-05-17 18:43:19 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapActions, mapState } from 'vuex';
|
2020-06-11 18:24:17 +00:00
|
|
|
import ECharts from 'vue-echarts';
|
|
|
|
import 'echarts/lib/chart/bar';
|
|
|
|
import 'echarts/lib/chart/line';
|
2020-06-12 05:17:48 +00:00
|
|
|
import 'echarts/lib/component/tooltip';
|
|
|
|
import 'echarts/lib/component/legend';
|
|
|
|
|
|
|
|
// Define Column labels here to avoid typos
|
|
|
|
const CHART_ABS_PROFIT = 'Absolute profit';
|
|
|
|
const CHART_TRADE_COUNT = 'Trade Count';
|
2020-05-17 18:43:19 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'DailyStats',
|
2020-06-11 18:24:17 +00:00
|
|
|
components: {
|
|
|
|
'v-chart': ECharts,
|
|
|
|
},
|
2020-05-17 18:43:19 +00:00
|
|
|
computed: {
|
|
|
|
...mapState('ftbot', ['dailyStats']),
|
2020-06-04 18:06:58 +00:00
|
|
|
dailyFields() {
|
2020-05-17 18:43:19 +00:00
|
|
|
return [
|
|
|
|
{ key: 'date', label: 'Day' },
|
|
|
|
{ key: 'abs_profit', label: 'Profit' },
|
|
|
|
{ key: 'fiat_value', label: `In ${this.dailyStats.fiat_display_currency}` },
|
|
|
|
{ key: 'trade_count', label: 'Trades' },
|
|
|
|
];
|
|
|
|
},
|
2020-06-11 18:24:17 +00:00
|
|
|
dailyChart() {
|
|
|
|
return {
|
|
|
|
title: {
|
2020-06-11 18:25:44 +00:00
|
|
|
text: 'Daily profit',
|
|
|
|
show: true,
|
2020-06-11 18:24:17 +00:00
|
|
|
},
|
|
|
|
dataset: {
|
|
|
|
dimensions: ['date', 'abs_profit', 'trade_count'],
|
|
|
|
source: this.dailyStats.data,
|
|
|
|
},
|
2020-06-12 05:17:48 +00:00
|
|
|
tooltip: {
|
|
|
|
trigger: 'axis',
|
|
|
|
axisPointer: {
|
|
|
|
type: 'line',
|
|
|
|
label: {
|
|
|
|
backgroundColor: '#6a7985',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
data: [CHART_ABS_PROFIT, CHART_TRADE_COUNT],
|
|
|
|
},
|
2020-06-11 18:24:17 +00:00
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
inverse: true,
|
|
|
|
},
|
|
|
|
yAxis: [
|
|
|
|
{
|
|
|
|
type: 'value',
|
2020-06-12 05:17:48 +00:00
|
|
|
name: CHART_ABS_PROFIT,
|
2020-06-11 18:24:17 +00:00
|
|
|
splitLine: {
|
|
|
|
show: false,
|
|
|
|
},
|
|
|
|
nameRotate: 90,
|
|
|
|
nameLocation: 'middle',
|
|
|
|
nameGap: 30,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'value',
|
2020-06-12 05:17:48 +00:00
|
|
|
name: CHART_TRADE_COUNT,
|
2020-06-11 18:24:17 +00:00
|
|
|
nameRotate: 90,
|
|
|
|
nameLocation: 'middle',
|
|
|
|
nameGap: 30,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
series: [
|
|
|
|
{
|
|
|
|
type: 'line',
|
2020-06-12 05:17:48 +00:00
|
|
|
name: CHART_ABS_PROFIT,
|
|
|
|
color: 'black',
|
2020-06-11 18:24:17 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'bar',
|
2020-06-12 05:17:48 +00:00
|
|
|
name: CHART_TRADE_COUNT,
|
|
|
|
color: 'rgba(150,150,150,0.3)',
|
2020-06-11 18:24:17 +00:00
|
|
|
yAxisIndex: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
},
|
2020-05-17 18:43:19 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions('ftbot', ['getDaily']),
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.getDaily();
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|