mirror of
https://github.com/freqtrade/frequi.git
synced 2024-09-20 09:31:10 +00:00
Add support for forcebuy ordertypes
This commit is contained in:
parent
4a49907a2e
commit
01a29a9be0
|
@ -30,6 +30,21 @@
|
||||||
@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.1"
|
||||||
|
label="*OrderType"
|
||||||
|
label-for="ordertype-input"
|
||||||
|
invalid-feedback="OrderType"
|
||||||
|
>
|
||||||
|
<b-select
|
||||||
|
v-model="ordertype"
|
||||||
|
class="ml-2"
|
||||||
|
:options="['market', 'limit']"
|
||||||
|
style="min-width: 7em"
|
||||||
|
size="sm"
|
||||||
|
>
|
||||||
|
</b-select>
|
||||||
|
</b-form-group>
|
||||||
</form>
|
</form>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
</div>
|
</div>
|
||||||
|
@ -38,7 +53,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from 'vue-property-decorator';
|
import { Component, Vue } from 'vue-property-decorator';
|
||||||
import { namespace } from 'vuex-class';
|
import { namespace } from 'vuex-class';
|
||||||
import { ForcebuyPayload } from '@/types';
|
import { BotState, ForcebuyPayload } from '@/types';
|
||||||
|
import { BotStoreGetters } from '@/store/modules/ftbot';
|
||||||
|
|
||||||
const ftbot = namespace('ftbot');
|
const ftbot = namespace('ftbot');
|
||||||
|
|
||||||
|
@ -48,10 +64,16 @@ export default class ForceBuyForm extends Vue {
|
||||||
|
|
||||||
price = null;
|
price = null;
|
||||||
|
|
||||||
|
ordertype?: string = '';
|
||||||
|
|
||||||
$refs!: {
|
$refs!: {
|
||||||
form: HTMLFormElement;
|
form: HTMLFormElement;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ftbot.Getter [BotStoreGetters.botState]?: BotState;
|
||||||
|
|
||||||
|
@ftbot.Getter [BotStoreGetters.botApiVersion]: number;
|
||||||
|
|
||||||
// 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>;
|
||||||
|
|
||||||
|
@ -77,8 +99,12 @@ export default class ForceBuyForm extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
resetForm() {
|
resetForm() {
|
||||||
|
console.log('resetForm');
|
||||||
this.pair = '';
|
this.pair = '';
|
||||||
this.price = null;
|
this.price = null;
|
||||||
|
if (this.botApiVersion > 1.1) {
|
||||||
|
this.ordertype = this.botState?.order_types?.forcebuy || this.botState?.order_types?.buy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
|
@ -91,6 +117,9 @@ export default class ForceBuyForm extends Vue {
|
||||||
if (this.price) {
|
if (this.price) {
|
||||||
payload.price = Number(this.price);
|
payload.price = Number(this.price);
|
||||||
}
|
}
|
||||||
|
if (this.ordertype) {
|
||||||
|
payload.ordertype = this.ordertype;
|
||||||
|
}
|
||||||
this.forcebuy(payload);
|
this.forcebuy(payload);
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$bvModal.hide('forcebuy-modal');
|
this.$bvModal.hide('forcebuy-modal');
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
export interface ForcebuyPayload {
|
export interface ForcebuyPayload {
|
||||||
pair: string;
|
pair: string;
|
||||||
price?: number;
|
price?: number;
|
||||||
|
ordertype?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PerformanceEntry {
|
export interface PerformanceEntry {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user