Allow stake-amount when forcebuying

This commit is contained in:
Matthias 2022-01-22 15:00:12 +01:00
parent 9413e75b12
commit 367527ce9c
2 changed files with 23 additions and 0 deletions

View File

@ -30,6 +30,20 @@
@keydown.enter.native="handleBuy"
></b-form-input>
</b-form-group>
<b-form-group
v-if="botApiVersion > 1.12"
:label="`*Stake-amount in ${stakeCurrency} [optional]`"
label-for="stake-input"
invalid-feedback="Stake-amount must be empty or a positive number"
>
<b-form-input
id="stake-input"
v-model="stakeAmount"
type="number"
step="0.000001"
@keydown.enter.native="handleBuy"
></b-form-input>
</b-form-group>
<b-form-group
v-if="botApiVersion > 1.1"
label="*OrderType"
@ -65,6 +79,8 @@ export default class ForceBuyForm extends Vue {
price = null;
stakeAmount = null;
ordertype?: string = '';
$refs!: {
@ -75,6 +91,8 @@ export default class ForceBuyForm extends Vue {
@ftbot.Getter [BotStoreGetters.botApiVersion]: number;
@ftbot.Getter [BotStoreGetters.stakeCurrency]!: string;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ftbot.Action forcebuy!: (payload: ForcebuyPayload) => Promise<string>;
@ -103,6 +121,7 @@ export default class ForceBuyForm extends Vue {
console.log('resetForm');
this.pair = '';
this.price = null;
this.stakeAmount = null;
if (this.botApiVersion > 1.1) {
this.ordertype = this.botState?.order_types?.forcebuy || this.botState?.order_types?.buy;
}
@ -121,6 +140,9 @@ export default class ForceBuyForm extends Vue {
if (this.ordertype) {
payload.ordertype = this.ordertype;
}
if (this.stakeAmount) {
payload.stakeamount = this.stakeAmount;
}
this.forcebuy(payload);
this.$nextTick(() => {
this.$bvModal.hide('forcebuy-modal');

View File

@ -2,6 +2,7 @@ export interface ForcebuyPayload {
pair: string;
price?: number;
ordertype?: string;
stakeamount?: number;
}
export interface ForceSellPayload {