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>
|
<template>
|
||||||
<profit-pill
|
<profit-pill
|
||||||
:profit-ratio="trade.profit_ratio"
|
:profit-ratio="profitRatio"
|
||||||
:profit-abs="trade.profit_abs"
|
:profit-abs="profitAbs"
|
||||||
:profit-desc="profitDesc"
|
:profit-desc="profitDesc"
|
||||||
:stake-currency="trade.quote_currency || 'USDT'"
|
:stake-currency="trade.quote_currency || 'USDT'"
|
||||||
/>
|
/>
|
||||||
|
@ -16,6 +16,7 @@ import { computed } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
trade: { required: true, type: Object as () => Trade },
|
trade: { required: true, type: Object as () => Trade },
|
||||||
|
mode: { required: false, default: 'default', type: String },
|
||||||
});
|
});
|
||||||
const profitDesc = computed((): string => {
|
const profitDesc = computed((): string => {
|
||||||
let profit = `Current profit: ${formatPercent(props.trade.profit_ratio)} (${
|
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)}`;
|
profit += `\nOpen since: ${timestampms(props.trade.open_timestamp)}`;
|
||||||
return profit;
|
return profit;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const profitRatio = computed<number | undefined>(() => {
|
||||||
|
return props.trade.profit_ratio;
|
||||||
|
});
|
||||||
|
const profitAbs = computed<number | undefined>(() => {
|
||||||
|
return props.trade.profit_abs;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user