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"
|
||||
></b-form-input>
|
||||
</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>
|
||||
</b-modal>
|
||||
</div>
|
||||
|
@ -38,7 +53,8 @@
|
|||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import { namespace } from 'vuex-class';
|
||||
import { ForcebuyPayload } from '@/types';
|
||||
import { BotState, ForcebuyPayload } from '@/types';
|
||||
import { BotStoreGetters } from '@/store/modules/ftbot';
|
||||
|
||||
const ftbot = namespace('ftbot');
|
||||
|
||||
|
@ -48,10 +64,16 @@ export default class ForceBuyForm extends Vue {
|
|||
|
||||
price = null;
|
||||
|
||||
ordertype?: string = '';
|
||||
|
||||
$refs!: {
|
||||
form: HTMLFormElement;
|
||||
};
|
||||
|
||||
@ftbot.Getter [BotStoreGetters.botState]?: BotState;
|
||||
|
||||
@ftbot.Getter [BotStoreGetters.botApiVersion]: number;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
@ftbot.Action forcebuy!: (payload: ForcebuyPayload) => Promise<string>;
|
||||
|
||||
|
@ -77,8 +99,12 @@ export default class ForceBuyForm extends Vue {
|
|||
}
|
||||
|
||||
resetForm() {
|
||||
console.log('resetForm');
|
||||
this.pair = '';
|
||||
this.price = null;
|
||||
if (this.botApiVersion > 1.1) {
|
||||
this.ordertype = this.botState?.order_types?.forcebuy || this.botState?.order_types?.buy;
|
||||
}
|
||||
}
|
||||
|
||||
handleSubmit() {
|
||||
|
@ -91,6 +117,9 @@ export default class ForceBuyForm extends Vue {
|
|||
if (this.price) {
|
||||
payload.price = Number(this.price);
|
||||
}
|
||||
if (this.ordertype) {
|
||||
payload.ordertype = this.ordertype;
|
||||
}
|
||||
this.forcebuy(payload);
|
||||
this.$nextTick(() => {
|
||||
this.$bvModal.hide('forcebuy-modal');
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
export interface ForcebuyPayload {
|
||||
pair: string;
|
||||
price?: number;
|
||||
ordertype?: string;
|
||||
}
|
||||
|
||||
export interface PerformanceEntry {
|
||||
|
|
Loading…
Reference in New Issue
Block a user