-
-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract BT breakdowns to their own component
(it's 3 identical tables after all()
- Loading branch information
Showing
2 changed files
with
74 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script setup lang="ts"> | ||
import { formatPercent, formatPrice } from '@/shared/formatters'; | ||
import type { ExitReasonResults, PairResult } from '@/types'; | ||
import { TableItem } from 'bootstrap-vue-next'; | ||
const props = defineProps({ | ||
title: { type: String, required: true }, | ||
results: { type: Array as PropType<(PairResult | ExitReasonResults)[]>, required: true }, | ||
stakeCurrency: { type: String, required: true }, | ||
stakeCurrencyDecimals: { type: Number, required: true }, | ||
keyHeader: { type: String, default: 'Tag' }, | ||
}); | ||
const tableItems = computed(() => props.results as unknown as TableItem[]); | ||
const perTagReason = computed(() => { | ||
return [ | ||
{ | ||
key: 'key', | ||
label: props.keyHeader, | ||
formatter: (value, _, item) => value || item['exit_reason'] || 'OTHER', | ||
}, | ||
{ key: 'trades', label: 'Entries' }, | ||
{ | ||
key: 'profit_mean', | ||
label: 'Avg Profit %', | ||
formatter: (value) => formatPercent(value, 2), | ||
}, | ||
{ | ||
key: 'profit_total_abs', | ||
label: `Tot Profit ${props.stakeCurrency}`, | ||
formatter: (value) => formatPrice(value, props.stakeCurrencyDecimals), | ||
}, | ||
{ | ||
key: 'profit_total', | ||
label: 'Tot Profit %', | ||
formatter: (value) => formatPercent(value, 2), | ||
}, | ||
{ key: 'wins', label: 'Wins' }, | ||
{ key: 'draws', label: 'Draws' }, | ||
{ key: 'losses', label: 'Losses' }, | ||
]; | ||
}); | ||
</script> | ||
<template> | ||
<b-card :header="title"> | ||
<b-table small hover stacked="sm" :items="tableItems" :fields="perTagReason"> </b-table> | ||
</b-card> | ||
</template> |