frequi_origin/src/components/ftbot/BotControls.vue

130 lines
3.5 KiB
Vue
Raw Normal View History

2020-05-06 04:38:57 +00:00
<template>
<div class="container-fluid">
<div class="row">
<button
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading || isRunning"
title="Start Trading"
@click="startBot()"
>
2020-11-13 19:19:16 +00:00
<PlayIcon />
</button>
<button
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading || !isRunning"
title="Stop Trading - Also stops handling open trades."
@click="handleStopBot()"
>
2020-11-13 19:19:16 +00:00
<StopIcon />
</button>
<button
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading || !isRunning"
title="StopBuy - Stops buying, but still handles open trades"
@click="handleStopBuy()"
>
2020-11-13 19:19:16 +00:00
<PauseIcon />
</button>
<button
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading"
title="Reload Config - reloads configuration including strategy, resetting all settings changed on the fly."
@click="handleReloadConfig()"
>
2020-11-13 19:19:16 +00:00
<ReloadIcon />
2020-08-31 18:01:51 +00:00
</button>
2020-05-15 17:28:20 +00:00
<button
2021-01-16 15:07:06 +00:00
v-if="botState && botState.forcebuy_enabled"
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading || !isRunning"
title="Force Buy - Immediately buy an asset at an optional price. Sells are then handled according to strategy rules."
2020-06-04 18:06:58 +00:00
@click="initiateForcebuy"
2020-05-15 17:28:20 +00:00
>
2020-11-13 19:19:16 +00:00
<ForceBuyIcon />
2020-05-14 16:10:57 +00:00
</button>
2020-11-08 10:08:27 +00:00
<button
2021-06-22 19:04:18 +00:00
v-if="isWebserverMode && false"
2020-11-08 10:08:27 +00:00
:disabled="isTrading"
2020-11-20 05:54:42 +00:00
class="btn btn-secondary btn-sm ml-1"
title="Start Trading mode"
2020-11-08 10:08:27 +00:00
@click="startTrade()"
>
2020-11-13 19:19:16 +00:00
<PlayIcon />
2020-11-08 10:08:27 +00:00
</button>
2021-03-08 06:46:40 +00:00
<ForceBuyForm :modal-show="forcebuyShow" @close="$bvModal.hide('forcebuy-modal')" />
2020-05-06 04:38:57 +00:00
</div>
</div>
</template>
2020-08-09 13:23:04 +00:00
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { namespace } from 'vuex-class';
2020-11-08 10:40:26 +00:00
import { BotState } from '@/types';
import { BotStoreGetters } from '@/store/modules/ftbot';
2020-11-13 19:19:16 +00:00
import PlayIcon from 'vue-material-design-icons/Play.vue';
import StopIcon from 'vue-material-design-icons/Stop.vue';
import PauseIcon from 'vue-material-design-icons/Pause.vue';
import ReloadIcon from 'vue-material-design-icons/Reload.vue';
2020-11-20 05:54:42 +00:00
import ForceBuyIcon from 'vue-material-design-icons/PlusBoxMultipleOutline.vue';
2020-05-14 16:10:57 +00:00
import ForceBuyForm from './ForceBuyForm.vue';
2020-05-06 04:38:57 +00:00
2020-08-09 13:23:04 +00:00
const ftbot = namespace('ftbot');
2020-11-13 19:19:16 +00:00
@Component({
components: { ForceBuyForm, PlayIcon, StopIcon, PauseIcon, ReloadIcon, ForceBuyIcon },
})
2020-08-09 13:23:04 +00:00
export default class BotControls extends Vue {
forcebuyShow = false;
2021-01-16 15:07:06 +00:00
@ftbot.State botState?: BotState;
2020-08-09 13:23:04 +00:00
@ftbot.Action startBot;
@ftbot.Action stopBot;
@ftbot.Action stopBuy;
@ftbot.Action reloadConfig;
2020-11-08 10:08:27 +00:00
@ftbot.Action startTrade;
2020-11-08 10:40:26 +00:00
@ftbot.Getter [BotStoreGetters.isTrading]!: boolean;
@ftbot.Getter [BotStoreGetters.isWebserverMode]!: boolean;
get isRunning(): boolean {
2021-01-16 15:07:06 +00:00
return this.botState?.state === 'running';
}
2020-08-09 13:23:04 +00:00
initiateForcebuy() {
this.$bvModal.show('forcebuy-modal');
}
handleStopBot() {
this.$bvModal.msgBoxConfirm('Stop Bot?').then((value: boolean) => {
if (value) {
this.stopBot();
}
});
}
handleStopBuy() {
this.$bvModal
.msgBoxConfirm('Stop buying? Freqtrade will continue to handle open trades.')
.then((value: boolean) => {
if (value) {
this.stopBuy();
}
});
}
handleReloadConfig() {
this.$bvModal.msgBoxConfirm('Reload configuration?').then((value: boolean) => {
if (value) {
this.reloadConfig();
}
});
}
2020-08-09 13:23:04 +00:00
}
2020-05-06 04:38:57 +00:00
</script>