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" @keydown.enter.native="handleBuy"
></b-form-input> ></b-form-input>
</b-form-group> </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 <b-form-group
v-if="botApiVersion > 1.1" v-if="botApiVersion > 1.1"
label="*OrderType" label="*OrderType"
@ -65,6 +79,8 @@ export default class ForceBuyForm extends Vue {
price = null; price = null;
stakeAmount = null;
ordertype?: string = ''; ordertype?: string = '';
$refs!: { $refs!: {
@ -75,6 +91,8 @@ export default class ForceBuyForm extends Vue {
@ftbot.Getter [BotStoreGetters.botApiVersion]: number; @ftbot.Getter [BotStoreGetters.botApiVersion]: number;
@ftbot.Getter [BotStoreGetters.stakeCurrency]!: string;
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
@ftbot.Action forcebuy!: (payload: ForcebuyPayload) => Promise<string>; @ftbot.Action forcebuy!: (payload: ForcebuyPayload) => Promise<string>;
@ -103,6 +121,7 @@ export default class ForceBuyForm extends Vue {
console.log('resetForm'); console.log('resetForm');
this.pair = ''; this.pair = '';
this.price = null; this.price = null;
this.stakeAmount = null;
if (this.botApiVersion > 1.1) { if (this.botApiVersion > 1.1) {
this.ordertype = this.botState?.order_types?.forcebuy || this.botState?.order_types?.buy; 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) { if (this.ordertype) {
payload.ordertype = this.ordertype; payload.ordertype = this.ordertype;
} }
if (this.stakeAmount) {
payload.stakeamount = this.stakeAmount;
}
this.forcebuy(payload); this.forcebuy(payload);
this.$nextTick(() => { this.$nextTick(() => {
this.$bvModal.hide('forcebuy-modal'); this.$bvModal.hide('forcebuy-modal');

View File

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