mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-11 02:33:51 +00:00
composition: DailyStats
This commit is contained in:
parent
5298127402
commit
fdfeed35af
|
@ -14,38 +14,42 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import { defineComponent, computed, onMounted } from '@vue/composition-api';
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
|
||||||
import DailyChart from '@/components/charts/DailyChart.vue';
|
import DailyChart from '@/components/charts/DailyChart.vue';
|
||||||
import { formatPrice } from '@/shared/formatters';
|
import { formatPrice } from '@/shared/formatters';
|
||||||
import { BotStoreGetters } from '@/store/modules/ftbot';
|
import { BotStoreGetters } from '@/store/modules/ftbot';
|
||||||
import StoreModules from '@/store/storeSubModules';
|
import StoreModules from '@/store/storeSubModules';
|
||||||
|
import { useNamespacedActions, useNamespacedGetters } from 'vuex-composition-helpers';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default defineComponent({
|
||||||
name: 'DailyStats',
|
name: 'DailyStats',
|
||||||
components: {
|
components: {
|
||||||
DailyChart,
|
DailyChart,
|
||||||
},
|
},
|
||||||
computed: {
|
setup() {
|
||||||
...mapGetters(StoreModules.ftbot, [BotStoreGetters.dailyStats]),
|
const { dailyStats } = useNamespacedGetters(StoreModules.ftbot, [BotStoreGetters.dailyStats]);
|
||||||
dailyFields() {
|
const { getDaily } = useNamespacedActions(StoreModules.ftbot, ['getDaily']);
|
||||||
|
const dailyFields = computed(() => {
|
||||||
return [
|
return [
|
||||||
{ key: 'date', label: 'Day' },
|
{ key: 'date', label: 'Day' },
|
||||||
{ key: 'abs_profit', label: 'Profit', formatter: (value) => formatPrice(value) },
|
{ key: 'abs_profit', label: 'Profit', formatter: (value) => formatPrice(value) },
|
||||||
{
|
{
|
||||||
key: 'fiat_value',
|
key: 'fiat_value',
|
||||||
label: `In ${this.dailyStats.fiat_display_currency}`,
|
label: `In ${dailyStats.value.fiat_display_currency}`,
|
||||||
formatter: (value) => formatPrice(value, 2),
|
formatter: (value) => formatPrice(value, 2),
|
||||||
},
|
},
|
||||||
{ key: 'trade_count', label: 'Trades' },
|
{ key: 'trade_count', label: 'Trades' },
|
||||||
];
|
];
|
||||||
},
|
});
|
||||||
},
|
onMounted(() => {
|
||||||
mounted() {
|
getDaily();
|
||||||
this.getDaily();
|
});
|
||||||
},
|
|
||||||
methods: {
|
return {
|
||||||
...mapActions(StoreModules.ftbot, ['getDaily']),
|
getDaily,
|
||||||
|
dailyFields,
|
||||||
|
dailyStats,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user