mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-25 20:45:15 +00:00
Format prices in daily stats
This commit is contained in:
parent
f6ea46712f
commit
da3460ca0f
|
@ -17,6 +17,7 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { mapActions, mapState } from 'vuex';
|
import { mapActions, mapState } from 'vuex';
|
||||||
import DailyChart from '@/components/charts/DailyChart.vue';
|
import DailyChart from '@/components/charts/DailyChart.vue';
|
||||||
|
import { formatPrice } from '@/shared/formatters';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'DailyStats',
|
name: 'DailyStats',
|
||||||
|
@ -28,8 +29,12 @@ export default Vue.extend({
|
||||||
dailyFields() {
|
dailyFields() {
|
||||||
return [
|
return [
|
||||||
{ key: 'date', label: 'Day' },
|
{ key: 'date', label: 'Day' },
|
||||||
{ key: 'abs_profit', label: 'Profit' },
|
{ key: 'abs_profit', label: 'Profit', formatter: (value) => formatPrice(value) },
|
||||||
{ key: 'fiat_value', label: `In ${this.dailyStats.fiat_display_currency}` },
|
{
|
||||||
|
key: 'fiat_value',
|
||||||
|
label: `In ${this.dailyStats.fiat_display_currency}`,
|
||||||
|
formatter: (value) => formatPrice(value, 2),
|
||||||
|
},
|
||||||
{ key: 'trade_count', label: 'Trades' },
|
{ key: 'trade_count', label: 'Trades' },
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,8 +5,8 @@ export function formatPercent(value: number, decimals = 3): string {
|
||||||
return value ? `${(value * 100).toFixed(decimals)}%` : '';
|
return value ? `${(value * 100).toFixed(decimals)}%` : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatPrice(value: number): string {
|
export function formatPrice(value: number, decimals = 8): string {
|
||||||
return value ? value.toFixed(8) : '';
|
return value ? value.toFixed(decimals) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function dateFromString(datestring: string, format: string): Date {
|
export function dateFromString(datestring: string, format: string): Date {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user