Show correct tooltip

This commit is contained in:
Matthias 2023-03-15 06:45:24 +01:00
parent 72083b2449
commit 24146fed40

View File

@ -32,14 +32,6 @@ const modeDescs: { [key in modes]: string } = {
realized: 'Realized profit',
};
const profitDesc = computed((): string => {
let profit = `${modeDescs[props.mode]}: ${formatPercent(props.trade.profit_ratio)} (${
props.trade.profit_abs
})`;
profit += `\nOpen since: ${timestampms(props.trade.open_timestamp)}`;
return profit;
});
const profitRatio = computed<number | undefined>(() => {
switch (props.mode) {
case 'default':
@ -64,6 +56,13 @@ const profitAbs = computed<number | undefined>(() => {
return undefined;
}
});
const profitDesc = computed((): string => {
let profit = `${modeDescs[props.mode]}: ${
profitRatio.value ? formatPercent(profitRatio.value) : ''
} (${profitAbs.value})`;
profit += `\nOpen since: ${timestampms(props.trade.open_timestamp)}`;
return profit;
});
</script>
<style scoped></style>