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
|
2022-11-18 18:48:15 +00:00
|
|
|
class="btn btn-secondary btn-sm ms-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
|
|
|
>
|
2023-05-09 04:49:13 +00:00
|
|
|
<PlayIcon height="24" width="24" />
|
2021-08-30 17:57:42 +00:00
|
|
|
</button>
|
|
|
|
<button
|
2022-11-18 18:48:15 +00:00
|
|
|
class="btn btn-secondary btn-sm ms-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()"
|
|
|
|
>
|
2023-05-09 04:49:13 +00:00
|
|
|
<StopIcon height="24" width="24" />
|
2021-08-30 17:57:42 +00:00
|
|
|
</button>
|
|
|
|
<button
|
2022-11-18 18:48:15 +00:00
|
|
|
class="btn btn-secondary btn-sm ms-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()"
|
|
|
|
>
|
2023-05-09 04:49:13 +00:00
|
|
|
<PauseIcon height="24" width="24" />
|
2021-08-30 17:57:42 +00:00
|
|
|
</button>
|
|
|
|
<button
|
2022-11-18 18:48:15 +00:00
|
|
|
class="btn btn-secondary btn-sm ms-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()"
|
|
|
|
>
|
2023-05-09 04:49:13 +00:00
|
|
|
<ReloadIcon height="24" width="24" />
|
2021-08-30 17:57:42 +00:00
|
|
|
</button>
|
2022-01-22 12:04:12 +00:00
|
|
|
<button
|
2022-11-18 18:48:15 +00:00
|
|
|
class="btn btn-secondary btn-sm ms-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
|
|
|
>
|
2023-05-09 04:49:13 +00:00
|
|
|
<ForceExitIcon height="24" width="24" />
|
2022-01-22 12:04:12 +00:00
|
|
|
</button>
|
2021-08-30 17:57:42 +00:00
|
|
|
<button
|
2023-04-22 16:29:36 +00:00
|
|
|
v-if="botStore.activeBot.botState && botStore.activeBot.botState.force_entry_enable"
|
2022-11-18 18:48:15 +00:00
|
|
|
class="btn btn-secondary btn-sm ms-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-11-19 09:53:04 +00:00
|
|
|
@click="forceEnter = true"
|
2021-08-30 17:57:42 +00:00
|
|
|
>
|
2023-05-09 04:49:13 +00:00
|
|
|
<ForceEntryIcon style="font-size: 20px" />
|
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"
|
2022-11-18 18:48:15 +00:00
|
|
|
class="btn btn-secondary btn-sm ms-1"
|
2021-08-30 17:57:42 +00:00
|
|
|
title="Start Trading mode"
|
2022-04-26 20:00:21 +00:00
|
|
|
@click="botStore.activeBot.startTrade()"
|
2021-08-30 17:57:42 +00:00
|
|
|
>
|
2023-05-09 04:49:13 +00:00
|
|
|
<PlayIcon class="fs-4" />
|
2021-08-30 17:57:42 +00:00
|
|
|
</button>
|
2022-11-19 09:53:04 +00:00
|
|
|
<ForceEntryForm v-model="forceEnter" :pair="botStore.activeBot.selectedPair" />
|
2022-12-03 07:24:51 +00:00
|
|
|
<MessageBox ref="msgBox" />
|
2020-05-06 04:38:57 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2020-08-09 13:23:04 +00:00
|
|
|
<script lang="ts">
|
2022-12-03 07:24:51 +00:00
|
|
|
import MessageBox, { MsgBoxObject } from '@/components/general/MessageBox.vue';
|
2022-04-19 04:53:35 +00:00
|
|
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
2023-05-09 04:49:13 +00:00
|
|
|
import { ForceSellPayload } from '@/types';
|
|
|
|
import { computed, defineComponent, ref } from 'vue';
|
|
|
|
import ForceExitIcon from '~icons/mdi/close-box-multiple';
|
|
|
|
import PauseIcon from '~icons/mdi/pause';
|
|
|
|
import PlayIcon from '~icons/mdi/play';
|
|
|
|
import ForceEntryIcon from '~icons/mdi/plus-box-multiple-outline';
|
|
|
|
import ReloadIcon from '~icons/mdi/reload';
|
|
|
|
import StopIcon from '~icons/mdi/stop';
|
|
|
|
|
|
|
|
import ForceEntryForm from './ForceEntryForm.vue';
|
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-12-03 07:24:51 +00:00
|
|
|
MessageBox,
|
2022-01-22 12:04:12 +00:00
|
|
|
},
|
2022-07-07 18:44:19 +00:00
|
|
|
setup() {
|
2022-04-19 04:53:35 +00:00
|
|
|
const botStore = useBotStore();
|
2022-11-19 09:53:04 +00:00
|
|
|
const forceEnter = ref<boolean>(false);
|
2022-12-03 07:24:51 +00:00
|
|
|
const msgBox = ref<typeof MessageBox>();
|
2022-04-16 05:43:26 +00:00
|
|
|
|
|
|
|
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 handleStopBot = () => {
|
2022-12-03 07:24:51 +00:00
|
|
|
const msg: MsgBoxObject = {
|
|
|
|
title: 'Stop Bot',
|
|
|
|
message: 'Stop the bot loop from running?',
|
|
|
|
accept: () => {
|
2022-12-04 16:07:10 +00:00
|
|
|
botStore.activeBot.stopBot();
|
2022-12-03 07:24:51 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
msgBox.value?.show(msg);
|
2022-04-16 05:43:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleStopBuy = () => {
|
2022-12-03 07:24:51 +00:00
|
|
|
const msg: MsgBoxObject = {
|
|
|
|
title: 'Stop Buying',
|
|
|
|
message: 'Freqtrade will continue to handle open trades.',
|
|
|
|
accept: () => {
|
|
|
|
botStore.activeBot.stopBuy();
|
|
|
|
},
|
|
|
|
};
|
|
|
|
msgBox.value?.show(msg);
|
2022-04-16 05:43:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleReloadConfig = () => {
|
2022-12-03 07:24:51 +00:00
|
|
|
const msg: MsgBoxObject = {
|
|
|
|
title: 'Reload',
|
|
|
|
message: 'Reload configuration (including strategy)?',
|
|
|
|
accept: () => {
|
|
|
|
console.log('reload...');
|
2022-04-19 04:53:35 +00:00
|
|
|
botStore.activeBot.reloadConfig();
|
2022-12-03 07:24:51 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
msgBox.value?.show(msg);
|
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-12-03 07:24:51 +00:00
|
|
|
const msg: MsgBoxObject = {
|
|
|
|
title: 'ForceExit all',
|
|
|
|
message: 'Really forceexit ALL trades?',
|
|
|
|
accept: () => {
|
2022-04-16 05:43:26 +00:00
|
|
|
const payload: ForceSellPayload = {
|
|
|
|
tradeid: 'all',
|
|
|
|
// TODO: support ordertype (?)
|
|
|
|
};
|
2022-04-21 17:36:12 +00:00
|
|
|
botStore.activeBot.forceexit(payload);
|
2022-12-03 07:24:51 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
msgBox.value?.show(msg);
|
2022-04-16 05:43:26 +00:00
|
|
|
};
|
|
|
|
return {
|
|
|
|
handleStopBot,
|
|
|
|
handleStopBuy,
|
|
|
|
handleReloadConfig,
|
2022-04-21 17:36:12 +00:00
|
|
|
handleForceExit,
|
2022-11-19 09:53:04 +00:00
|
|
|
forceEnter,
|
2022-04-19 04:53:35 +00:00
|
|
|
botStore,
|
2022-04-16 05:43:26 +00:00
|
|
|
isRunning,
|
2022-12-03 07:24:51 +00:00
|
|
|
msgBox,
|
2022-04-16 05:43:26 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
2020-05-06 04:38:57 +00:00
|
|
|
</script>
|