2022-04-21 17:36:12 +00:00
|
|
|
forceexit
|
2020-05-06 04:38:57 +00:00
|
|
|
<template>
|
2021-08-30 17:57:42 +00:00
|
|
|
<div>
|
|
|
|
<button
|
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
2022-04-19 04:53:35 +00:00
|
|
|
:disabled="!botStore.activeBot.isTrading || isRunning"
|
2021-08-30 17:57:42 +00:00
|
|
|
title="Start Trading"
|
2022-04-26 20:00:21 +00:00
|
|
|
@click="botStore.activeBot.startBot()"
|
2021-08-30 17:57:42 +00:00
|
|
|
>
|
|
|
|
<PlayIcon />
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
2022-04-19 04:53:35 +00:00
|
|
|
:disabled="!botStore.activeBot.isTrading || !isRunning"
|
2021-08-30 17:57:42 +00:00
|
|
|
title="Stop Trading - Also stops handling open trades."
|
|
|
|
@click="handleStopBot()"
|
|
|
|
>
|
|
|
|
<StopIcon />
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
2022-04-19 04:53:35 +00:00
|
|
|
:disabled="!botStore.activeBot.isTrading || !isRunning"
|
2021-08-30 17:57:42 +00:00
|
|
|
title="StopBuy - Stops buying, but still handles open trades"
|
|
|
|
@click="handleStopBuy()"
|
|
|
|
>
|
|
|
|
<PauseIcon />
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
2022-04-19 04:53:35 +00:00
|
|
|
:disabled="!botStore.activeBot.isTrading"
|
2021-08-30 17:57:42 +00:00
|
|
|
title="Reload Config - reloads configuration including strategy, resetting all settings changed on the fly."
|
|
|
|
@click="handleReloadConfig()"
|
|
|
|
>
|
|
|
|
<ReloadIcon />
|
|
|
|
</button>
|
2022-01-22 12:04:12 +00:00
|
|
|
<button
|
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
2022-04-19 04:53:35 +00:00
|
|
|
:disabled="!botStore.activeBot.isTrading"
|
2022-04-21 17:36:12 +00:00
|
|
|
title="Force exit all"
|
|
|
|
@click="handleForceExit()"
|
2022-01-22 12:04:12 +00:00
|
|
|
>
|
2022-04-21 17:36:12 +00:00
|
|
|
<ForceExitIcon />
|
2022-01-22 12:04:12 +00:00
|
|
|
</button>
|
2021-08-30 17:57:42 +00:00
|
|
|
<button
|
2022-04-19 04:53:35 +00:00
|
|
|
v-if="
|
|
|
|
botStore.activeBot.botState &&
|
|
|
|
(botStore.activeBot.botState.force_entry_enable ||
|
|
|
|
botStore.activeBot.botState.forcebuy_enabled)
|
|
|
|
"
|
2021-08-30 17:57:42 +00:00
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
2022-04-19 04:53:35 +00:00
|
|
|
:disabled="!botStore.activeBot.isTrading || !isRunning"
|
2022-04-21 17:36:12 +00:00
|
|
|
title="Force enter - Immediately enter a trade at an optional price. Exits are then handled according to strategy rules."
|
2022-01-27 05:52:35 +00:00
|
|
|
@click="initiateForceenter"
|
2021-08-30 17:57:42 +00:00
|
|
|
>
|
2022-04-21 17:36:12 +00:00
|
|
|
<ForceEntryIcon />
|
2021-08-30 17:57:42 +00:00
|
|
|
</button>
|
|
|
|
<button
|
2022-04-19 04:53:35 +00:00
|
|
|
v-if="botStore.activeBot.isWebserverMode && false"
|
2022-04-28 17:21:30 +00:00
|
|
|
:disabled="botStore.activeBot.isTrading"
|
2021-08-30 17:57:42 +00:00
|
|
|
class="btn btn-secondary btn-sm ml-1"
|
|
|
|
title="Start Trading mode"
|
2022-04-26 20:00:21 +00:00
|
|
|
@click="botStore.activeBot.startTrade()"
|
2021-08-30 17:57:42 +00:00
|
|
|
>
|
|
|
|
<PlayIcon />
|
|
|
|
</button>
|
2022-11-25 07:52:24 +00:00
|
|
|
<ForceEntryForm :pair="botStore.activeBot.selectedPair" @close="hideForceenter" />
|
2020-05-06 04:38:57 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2020-08-09 13:23:04 +00:00
|
|
|
<script lang="ts">
|
2022-04-16 05:43:26 +00:00
|
|
|
import { ForceSellPayload } from '@/types';
|
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';
|
2022-04-21 17:36:12 +00:00
|
|
|
import ForceExitIcon from 'vue-material-design-icons/CloseBoxMultiple.vue';
|
|
|
|
import ForceEntryIcon from 'vue-material-design-icons/PlusBoxMultipleOutline.vue';
|
2022-05-25 17:20:18 +00:00
|
|
|
import ForceEntryForm from './ForceEntryForm.vue';
|
2022-07-07 18:44:19 +00:00
|
|
|
import { defineComponent, computed, ref, getCurrentInstance } from 'vue';
|
2022-04-19 04:53:35 +00:00
|
|
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
2020-05-06 04:38:57 +00:00
|
|
|
|
2022-04-16 05:43:26 +00:00
|
|
|
export default defineComponent({
|
|
|
|
name: 'BotControls',
|
2022-01-22 12:04:12 +00:00
|
|
|
components: {
|
2022-05-25 17:20:18 +00:00
|
|
|
ForceEntryForm,
|
2022-01-22 12:04:12 +00:00
|
|
|
PlayIcon,
|
|
|
|
StopIcon,
|
|
|
|
PauseIcon,
|
|
|
|
ReloadIcon,
|
2022-04-21 17:36:12 +00:00
|
|
|
ForceExitIcon,
|
|
|
|
ForceEntryIcon,
|
2022-01-22 12:04:12 +00:00
|
|
|
},
|
2022-07-07 18:44:19 +00:00
|
|
|
setup() {
|
|
|
|
const root = getCurrentInstance();
|
2022-04-19 04:53:35 +00:00
|
|
|
const botStore = useBotStore();
|
2022-04-16 05:43:26 +00:00
|
|
|
const forcebuyShow = ref(false);
|
|
|
|
|
|
|
|
const isRunning = computed((): boolean => {
|
2022-04-19 04:53:35 +00:00
|
|
|
return botStore.activeBot.botState?.state === 'running';
|
2021-07-01 19:02:51 +00:00
|
|
|
});
|
|
|
|
|
2022-04-16 05:43:26 +00:00
|
|
|
const initiateForceenter = () => {
|
2022-07-09 18:04:22 +00:00
|
|
|
root?.proxy.$bvModal.show('forceentry-modal');
|
|
|
|
};
|
|
|
|
const hideForceenter = () => {
|
|
|
|
root?.proxy.$bvModal.hide('forceentry-modal');
|
2022-04-16 05:43:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleStopBot = () => {
|
2022-07-09 18:04:22 +00:00
|
|
|
root?.proxy.$bvModal.msgBoxConfirm('Stop Bot?').then((value: boolean) => {
|
2021-07-01 19:02:51 +00:00
|
|
|
if (value) {
|
2022-04-19 04:53:35 +00:00
|
|
|
botStore.activeBot.stopBot();
|
2021-07-01 19:02:51 +00:00
|
|
|
}
|
|
|
|
});
|
2022-04-16 05:43:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleStopBuy = () => {
|
2022-07-09 18:04:22 +00:00
|
|
|
root?.proxy.$bvModal
|
2022-04-16 05:43:26 +00:00
|
|
|
.msgBoxConfirm('Stop buying? Freqtrade will continue to handle open trades.')
|
|
|
|
.then((value: boolean) => {
|
|
|
|
if (value) {
|
2022-04-19 04:53:35 +00:00
|
|
|
botStore.activeBot.stopBuy();
|
2022-04-16 05:43:26 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleReloadConfig = () => {
|
2022-07-09 18:04:22 +00:00
|
|
|
root?.proxy.$bvModal.msgBoxConfirm('Reload configuration?').then((value: boolean) => {
|
2022-04-16 05:43:26 +00:00
|
|
|
if (value) {
|
2022-04-19 04:53:35 +00:00
|
|
|
botStore.activeBot.reloadConfig();
|
2022-04-16 05:43:26 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
2022-01-22 12:04:12 +00:00
|
|
|
|
2022-04-21 17:36:12 +00:00
|
|
|
const handleForceExit = () => {
|
2022-08-03 04:57:17 +00:00
|
|
|
root?.proxy.$bvModal.msgBoxConfirm(`Really forceexit ALL trades?`).then((value: boolean) => {
|
2022-04-16 05:43:26 +00:00
|
|
|
if (value) {
|
|
|
|
const payload: ForceSellPayload = {
|
|
|
|
tradeid: 'all',
|
|
|
|
// TODO: support ordertype (?)
|
|
|
|
};
|
2022-04-21 17:36:12 +00:00
|
|
|
botStore.activeBot.forceexit(payload);
|
2022-04-16 05:43:26 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
return {
|
|
|
|
initiateForceenter,
|
2022-07-09 18:04:22 +00:00
|
|
|
hideForceenter,
|
2022-04-16 05:43:26 +00:00
|
|
|
handleStopBot,
|
|
|
|
handleStopBuy,
|
|
|
|
handleReloadConfig,
|
2022-04-21 17:36:12 +00:00
|
|
|
handleForceExit,
|
2022-04-16 05:43:26 +00:00
|
|
|
forcebuyShow,
|
2022-04-19 04:53:35 +00:00
|
|
|
botStore,
|
2022-04-16 05:43:26 +00:00
|
|
|
isRunning,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
2020-05-06 04:38:57 +00:00
|
|
|
</script>
|