2020-05-06 04:38:57 +00:00
|
|
|
<template>
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row">
|
2020-11-08 10:00:48 +00:00
|
|
|
<button
|
2020-11-13 19:19:16 +00:00
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
2020-11-13 05:49:41 +00:00
|
|
|
:disabled="!isTrading || isRunning"
|
2020-11-13 06:40:16 +00:00
|
|
|
title="Start Trading"
|
2020-11-08 10:00:48 +00:00
|
|
|
@click="startBot()"
|
|
|
|
>
|
2020-11-13 19:19:16 +00:00
|
|
|
<PlayIcon />
|
2020-11-08 10:00:48 +00:00
|
|
|
</button>
|
2020-11-13 05:49:41 +00:00
|
|
|
<button
|
2020-11-13 19:19:16 +00:00
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
2020-11-13 05:49:41 +00:00
|
|
|
:disabled="!isTrading || !isRunning"
|
2020-11-13 06:40:16 +00:00
|
|
|
title="Stop Trading - Also stops handling open trades."
|
2021-07-01 19:02:51 +00:00
|
|
|
@click="handleStopBot()"
|
2020-11-13 05:49:41 +00:00
|
|
|
>
|
2020-11-13 19:19:16 +00:00
|
|
|
<StopIcon />
|
2020-11-08 10:00:48 +00:00
|
|
|
</button>
|
2020-11-13 05:49:41 +00:00
|
|
|
<button
|
2020-11-13 19:19:16 +00:00
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
2020-11-13 05:49:41 +00:00
|
|
|
:disabled="!isTrading || !isRunning"
|
2020-11-13 06:40:16 +00:00
|
|
|
title="StopBuy - Stops buying, but still handles open trades"
|
2021-07-01 19:02:51 +00:00
|
|
|
@click="handleStopBuy()"
|
2020-11-13 05:49:41 +00:00
|
|
|
>
|
2020-11-13 19:19:16 +00:00
|
|
|
<PauseIcon />
|
2020-11-08 10:00:48 +00:00
|
|
|
</button>
|
|
|
|
<button
|
2020-11-13 19:19:16 +00:00
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
2020-11-08 10:00:48 +00:00
|
|
|
:disabled="!isTrading"
|
2020-11-13 06:40:16 +00:00
|
|
|
title="Reload Config - reloads configuration including strategy, resetting all settings changed on the fly."
|
2021-07-01 19:02:51 +00:00
|
|
|
@click="handleReloadConfig()"
|
2020-11-08 10:00:48 +00:00
|
|
|
>
|
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"
|
2020-11-13 05:49:41 +00:00
|
|
|
:disabled="!isTrading || !isRunning"
|
2020-11-13 06:40:16 +00:00
|
|
|
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"
|
2020-11-13 06:40:16 +00:00
|
|
|
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-08-26 18:35:33 +00:00
|
|
|
@ftbot.Getter [BotStoreGetters.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;
|
2020-11-08 10:00:48 +00:00
|
|
|
|
2020-11-13 05:49:41 +00:00
|
|
|
get isRunning(): boolean {
|
2021-01-16 15:07:06 +00:00
|
|
|
return this.botState?.state === 'running';
|
2020-11-13 05:49:41 +00:00
|
|
|
}
|
|
|
|
|
2020-08-09 13:23:04 +00:00
|
|
|
initiateForcebuy() {
|
|
|
|
this.$bvModal.show('forcebuy-modal');
|
|
|
|
}
|
2021-07-01 19:02:51 +00:00
|
|
|
|
|
|
|
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) {
|
2021-07-08 18:21:00 +00:00
|
|
|
this.reloadConfig();
|
2021-07-01 19:02:51 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-08-09 13:23:04 +00:00
|
|
|
}
|
2020-05-06 04:38:57 +00:00
|
|
|
</script>
|