mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 11:35:14 +00:00
Update tradeList to fix types
This commit is contained in:
parent
b08e1286c9
commit
213b5c3af1
|
@ -104,6 +104,7 @@ import ForceExitForm from '@/components/ftbot/ForceExitForm.vue';
|
||||||
import { ref, computed, watch } from 'vue';
|
import { ref, computed, watch } from 'vue';
|
||||||
import { useBotStore } from '@/stores/ftbotwrapper';
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { TableField } from 'bootstrap-vue-next';
|
||||||
|
|
||||||
enum ModalReasons {
|
enum ModalReasons {
|
||||||
removeTrade,
|
removeTrade,
|
||||||
|
@ -134,8 +135,8 @@ const removeTradeVisible = ref(false);
|
||||||
const confirmExitText = ref('');
|
const confirmExitText = ref('');
|
||||||
const confirmExitValue = ref<ModalReasons | null>(null);
|
const confirmExitValue = ref<ModalReasons | null>(null);
|
||||||
|
|
||||||
const openFields: Record<string, string | Function>[] = [{ key: 'actions' }];
|
const openFields: TableField[] = [{ key: 'actions' }];
|
||||||
const closedFields: Record<string, string | Function>[] = [
|
const closedFields: TableField[] = [
|
||||||
{ key: 'close_timestamp', label: 'Close date' },
|
{ key: 'close_timestamp', label: 'Close date' },
|
||||||
{ key: 'exit_reason', label: 'Close Reason' },
|
{ key: 'exit_reason', label: 'Close Reason' },
|
||||||
];
|
];
|
||||||
|
@ -146,8 +147,8 @@ const rows = computed(() => {
|
||||||
return props.trades.length;
|
return props.trades.length;
|
||||||
});
|
});
|
||||||
|
|
||||||
const tableFields: Record<string, string | Function>[] = [
|
const tableFields: TableField[] = [
|
||||||
props.multiBotView ? { key: 'botName', label: 'Bot' } : {},
|
props.multiBotView ? { key: 'botName', label: 'Bot' } : { key: 'actions' },
|
||||||
{ key: 'trade_id', label: 'ID' },
|
{ key: 'trade_id', label: 'ID' },
|
||||||
{ key: 'pair', label: 'Pair' },
|
{ key: 'pair', label: 'Pair' },
|
||||||
{ key: 'amount', label: 'Amount' },
|
{ key: 'amount', label: 'Amount' },
|
||||||
|
@ -158,19 +159,24 @@ const tableFields: Record<string, string | Function>[] = [
|
||||||
{
|
{
|
||||||
key: 'open_rate',
|
key: 'open_rate',
|
||||||
label: 'Open rate',
|
label: 'Open rate',
|
||||||
formatter: (value: number) => formatPrice(value),
|
formatter: (value: unknown) => formatPrice(value as number),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: props.activeTrades ? 'current_rate' : 'close_rate',
|
key: props.activeTrades ? 'current_rate' : 'close_rate',
|
||||||
label: props.activeTrades ? 'Current rate' : 'Close rate',
|
label: props.activeTrades ? 'Current rate' : 'Close rate',
|
||||||
formatter: (value: number) => formatPrice(value),
|
formatter: (value: unknown) => formatPrice(value as number),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'profit',
|
key: 'profit',
|
||||||
label: props.activeTrades ? 'Current profit %' : 'Profit %',
|
label: props.activeTrades ? 'Current profit %' : 'Profit %',
|
||||||
formatter: (value: number, key, item: Trade) => {
|
|
||||||
const percent = formatPercent(item.profit_ratio, 2);
|
formatter: (value: unknown, key?: string, item?: unknown) => {
|
||||||
return `${percent} ${`(${formatPriceWithDecimals(item.profit_abs)})`}`;
|
if (!item) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const typedItem = item as Trade;
|
||||||
|
const percent = formatPercent(typedItem.profit_ratio, 2);
|
||||||
|
return `${percent} ${`(${formatPriceWithDecimals(typedItem.profit_abs)})`}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'open_timestamp', label: 'Open date' },
|
{ key: 'open_timestamp', label: 'Open date' },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user