mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 11:35:14 +00:00
Use "computed" for profit variables
This commit is contained in:
parent
2c9a01bae2
commit
7ba0ef0512
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<profit-pill
|
||||
:profit-ratio="trade.profit_ratio"
|
||||
:profit-abs="trade.profit_abs"
|
||||
:profit-ratio="profitRatio"
|
||||
:profit-abs="profitAbs"
|
||||
:profit-desc="profitDesc"
|
||||
:stake-currency="trade.quote_currency || 'USDT'"
|
||||
/>
|
||||
|
@ -16,6 +16,7 @@ import { computed } from 'vue';
|
|||
|
||||
const props = defineProps({
|
||||
trade: { required: true, type: Object as () => Trade },
|
||||
mode: { required: false, default: 'default', type: String },
|
||||
});
|
||||
const profitDesc = computed((): string => {
|
||||
let profit = `Current profit: ${formatPercent(props.trade.profit_ratio)} (${
|
||||
|
@ -24,6 +25,13 @@ const profitDesc = computed((): string => {
|
|||
profit += `\nOpen since: ${timestampms(props.trade.open_timestamp)}`;
|
||||
return profit;
|
||||
});
|
||||
|
||||
const profitRatio = computed<number | undefined>(() => {
|
||||
return props.trade.profit_ratio;
|
||||
});
|
||||
const profitAbs = computed<number | undefined>(() => {
|
||||
return props.trade.profit_abs;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
Loading…
Reference in New Issue
Block a user