Show botcontrols only when the bot is trading

This commit is contained in:
Matthias 2020-11-08 11:00:48 +01:00
parent 1aa15cb18d
commit 554f64e91e
2 changed files with 46 additions and 6 deletions

View File

@ -1,15 +1,30 @@
<template>
<div class="container-fluid">
<div class="row">
<button class="btn btn-primary btn-sm col-md-5 m-1" @click="startBot()">Start</button>
<button class="btn btn-primary btn-sm col-md-5 m-1" @click="stopBot()">Stop</button>
<button class="btn btn-primary btn-sm col-md-5 m-1" @click="stopBuy()">StopBuy</button>
<button class="btn btn-primary btn-sm col-md-5 m-1" @click="reloadConfig()">
<button
class="btn btn-primary btn-sm col-md-5 m-1"
:disabled="!isTrading"
@click="startBot()"
>
Start
</button>
<button class="btn btn-primary btn-sm col-md-5 m-1" :disabled="!isTrading" @click="stopBot()">
Stop
</button>
<button class="btn btn-primary btn-sm col-md-5 m-1" :disabled="!isTrading" @click="stopBuy()">
StopBuy
</button>
<button
class="btn btn-primary btn-sm col-md-5 m-1"
:disabled="!isTrading"
@click="reloadConfig()"
>
Reload Config
</button>
<button
v-if="botState.forcebuy_enabled"
class="btn btn-primary btn-sm col-md-5 m-1"
:disabled="!isTrading"
@click="initiateForcebuy"
>
Forcebuy
@ -22,7 +37,7 @@
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { namespace } from 'vuex-class';
import { BotState } from '@/types';
import { BotState, RunModes } from '@/types';
import ForceBuyForm from './ForceBuyForm.vue';
const ftbot = namespace('ftbot');
@ -41,6 +56,10 @@ export default class BotControls extends Vue {
@ftbot.Action reloadConfig;
get isTrading(): boolean {
return this.botState.runmode === RunModes.LIVE || this.botState.runmode === RunModes.DRY_RUN;
}
initiateForcebuy() {
this.$bvModal.show('forcebuy-modal');
}

View File

@ -41,7 +41,29 @@ export interface BalanceInterface {
value: number;
}
/** Values for BotState.state */
export enum BotStates {
RUNNING = 'running',
STOPPED = 'stopped',
RELOAD_CONFIG = 'reload_config',
}
export enum RunModes {
LIVE = 'live',
DRY_RUN = 'dry_run',
BACKTEST = 'backtest',
EDGE = 'edge',
HYPEROPT = 'hyperopt',
UTIL_EXCHANGE = 'util_exchange',
UTIL_NO_EXCHANGE = 'util_no_exchange',
PLOT = 'plot',
WEBSERVER = 'webserver',
OTHER = 'other',
}
export interface BotState {
state: BotStates;
runmode: RunModes;
bid_strategy: object;
ask_strategy: object;
dry_run: boolean;
@ -51,7 +73,6 @@ export interface BotState {
minimal_roi: object;
stake_amount: number;
stake_currency: string;
state: string;
stoploss: number;
strategy: string;
/** Timeframe in readable form (e.g. 5m) */