Skip to content

Commit 05ce049

Browse files
committed
feat: Display Stake currency value on partial force exit
1 parent c6384d2 commit 05ce049

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/components/ftbot/ForceExitForm.vue

+16-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
<span>Currently owning {{ trade.amount }} {{ trade.base_currency }}</span>
1616
</p>
1717
<BFormGroup
18-
:label="`*Amount in ${trade.base_currency} [optional]`"
1918
label-for="stake-input"
2019
invalid-feedback="Amount must be empty or a positive number"
2120
:state="amount !== undefined && amount > 0"
2221
>
22+
<template #label>
23+
<span class="fst-italic">*Amount in {{ trade.base_currency }} [optional]</span>
24+
<span class="ms-1 fst-italic">{{ amountInBase }}</span>
25+
</template>
2326
<BFormInput id="stake-input" v-model="amount" type="number" step="0.000001"></BFormInput>
2427
<BFormInput
2528
id="stake-input"
@@ -59,6 +62,10 @@ const props = defineProps({
5962
type: Object as () => Trade,
6063
required: true,
6164
},
65+
stakeCurrencyDecimals: {
66+
type: Number,
67+
required: true,
68+
},
6269
});
6370
6471
const model = defineModel<boolean>();
@@ -105,4 +112,12 @@ function handleEntry() {
105112
// Trigger submit handler
106113
handleSubmit();
107114
}
115+
116+
const amountDebounced = refDebounced(amount, 250, { maxWait: 500 });
117+
118+
const amountInBase = computed<string>(() => {
119+
return amountDebounced.value && props.trade.current_rate
120+
? `~${formatPriceCurrency(amountDebounced.value * props.trade.current_rate, props.trade.quote_currency || '', props.stakeCurrencyDecimals)} (Estimated value) `
121+
: '';
122+
});
108123
</script>

src/components/ftbot/TradeList.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@
7979
<BFormInput id="trade-filter" v-model="filterText" type="text" placeholder="Filter" />
8080
</BFormGroup>
8181
</div>
82-
<ForceExitForm v-if="activeTrades" v-model="forceExitVisible" :trade="feTrade" />
82+
<ForceExitForm
83+
v-if="activeTrades"
84+
v-model="forceExitVisible"
85+
:trade="feTrade"
86+
:quote-currency-decimals="botStore.activeBot.botState.stake_currency_decimals"
87+
/>
8388
<ForceEntryForm
8489
v-model="increasePosition.visible"
8590
:pair="increasePosition.trade?.pair"

0 commit comments

Comments
 (0)