Add leverage to forceentry field

This commit is contained in:
Matthias 2022-08-02 20:09:43 +02:00
parent b09189f0c1
commit 4a8b304802
2 changed files with 21 additions and 0 deletions

View File

@ -58,6 +58,20 @@
@keydown.enter.native="handleEntry" @keydown.enter.native="handleEntry"
></b-form-input> ></b-form-input>
</b-form-group> </b-form-group>
<b-form-group
v-if="botStore.activeBot.botApiVersion > 2.16 && botStore.activeBot.shortAllowed"
:label="`*Leverage to apply [optional]`"
label-for="leverage-input"
invalid-feedback="Leverage must be empty or a positive number"
>
<b-form-input
id="leverage-input"
v-model="leverage"
type="number"
step="1"
@keydown.enter.native="handleEntry"
></b-form-input>
</b-form-group>
<b-form-group <b-form-group
v-if="botStore.activeBot.botApiVersion > 1.1" v-if="botStore.activeBot.botApiVersion > 1.1"
label="*OrderType" label="*OrderType"
@ -94,6 +108,8 @@ export default defineComponent({
const pair = ref(''); const pair = ref('');
const price = ref<number | null>(null); const price = ref<number | null>(null);
const stakeAmount = ref<number | null>(null); const stakeAmount = ref<number | null>(null);
const leverage = ref<number | null>(null);
const ordertype = ref(''); const ordertype = ref('');
const orderSide = ref<OrderSides>(OrderSides.long); const orderSide = ref<OrderSides>(OrderSides.long);
@ -122,6 +138,9 @@ export default defineComponent({
if (botStore.activeBot.botApiVersion >= 2.13 && botStore.activeBot.shortAllowed) { if (botStore.activeBot.botApiVersion >= 2.13 && botStore.activeBot.shortAllowed) {
payload.side = orderSide.value; payload.side = orderSide.value;
} }
if (leverage.value) {
payload.leverage = leverage.value;
}
botStore.activeBot.forceentry(payload); botStore.activeBot.forceentry(payload);
nextTick(() => { nextTick(() => {
root?.proxy.$bvModal.hide('forceentry-modal'); root?.proxy.$bvModal.hide('forceentry-modal');
@ -159,6 +178,7 @@ export default defineComponent({
stakeAmount, stakeAmount,
ordertype, ordertype,
orderSide, orderSide,
leverage,
}; };
}, },
}); });

View File

@ -9,6 +9,7 @@ export interface ForceEnterPayload {
price?: number; price?: number;
ordertype?: string; ordertype?: string;
stakeamount?: number; stakeamount?: number;
leverage?: number;
} }
export interface ForceSellPayload { export interface ForceSellPayload {