Some minor updates

This commit is contained in:
Matthias 2022-04-21 19:36:12 +02:00
parent 4c08ec9030
commit 0c731255ab
3 changed files with 16 additions and 18 deletions

View File

@ -1,3 +1,4 @@
forceexit
<template> <template>
<div> <div>
<button <button
@ -35,10 +36,10 @@
<button <button
class="btn btn-secondary btn-sm ml-1" class="btn btn-secondary btn-sm ml-1"
:disabled="!botStore.activeBot.isTrading" :disabled="!botStore.activeBot.isTrading"
title="Forcesell all" title="Force exit all"
@click="handleForceSell()" @click="handleForceExit()"
> >
<ForceSellIcon /> <ForceExitIcon />
</button> </button>
<button <button
v-if=" v-if="
@ -48,10 +49,10 @@
" "
class="btn btn-secondary btn-sm ml-1" class="btn btn-secondary btn-sm ml-1"
:disabled="!botStore.activeBot.isTrading || !isRunning" :disabled="!botStore.activeBot.isTrading || !isRunning"
title="Force enter - Immediately buy an asset at an optional price. Sells are then handled according to strategy rules." title="Force enter - Immediately enter a trade at an optional price. Exits are then handled according to strategy rules."
@click="initiateForceenter" @click="initiateForceenter"
> >
<ForceBuyIcon /> <ForceEntryIcon />
</button> </button>
<button <button
v-if="botStore.activeBot.isWebserverMode && false" v-if="botStore.activeBot.isWebserverMode && false"
@ -72,8 +73,8 @@ import PlayIcon from 'vue-material-design-icons/Play.vue';
import StopIcon from 'vue-material-design-icons/Stop.vue'; import StopIcon from 'vue-material-design-icons/Stop.vue';
import PauseIcon from 'vue-material-design-icons/Pause.vue'; import PauseIcon from 'vue-material-design-icons/Pause.vue';
import ReloadIcon from 'vue-material-design-icons/Reload.vue'; import ReloadIcon from 'vue-material-design-icons/Reload.vue';
import ForceSellIcon from 'vue-material-design-icons/CloseBoxMultiple.vue'; import ForceExitIcon from 'vue-material-design-icons/CloseBoxMultiple.vue';
import ForceBuyIcon from 'vue-material-design-icons/PlusBoxMultipleOutline.vue'; import ForceEntryIcon from 'vue-material-design-icons/PlusBoxMultipleOutline.vue';
import ForceBuyForm from './ForceBuyForm.vue'; import ForceBuyForm from './ForceBuyForm.vue';
import { defineComponent, computed, ref } from '@vue/composition-api'; import { defineComponent, computed, ref } from '@vue/composition-api';
import { useBotStore } from '@/stores/ftbotwrapper'; import { useBotStore } from '@/stores/ftbotwrapper';
@ -86,8 +87,8 @@ export default defineComponent({
StopIcon, StopIcon,
PauseIcon, PauseIcon,
ReloadIcon, ReloadIcon,
ForceSellIcon, ForceExitIcon,
ForceBuyIcon, ForceEntryIcon,
}, },
setup(_, { root }) { setup(_, { root }) {
const botStore = useBotStore(); const botStore = useBotStore();
@ -127,14 +128,14 @@ export default defineComponent({
}); });
}; };
const handleForceSell = () => { const handleForceExit = () => {
root.$bvModal.msgBoxConfirm(`Really forcesell ALL trades?`).then((value: boolean) => { root.$bvModal.msgBoxConfirm(`Really forcesell ALL trades?`).then((value: boolean) => {
if (value) { if (value) {
const payload: ForceSellPayload = { const payload: ForceSellPayload = {
tradeid: 'all', tradeid: 'all',
// TODO: support ordertype (?) // TODO: support ordertype (?)
}; };
botStore.activeBot.forcesell(payload); botStore.activeBot.forceexit(payload);
} }
}); });
}; };
@ -143,7 +144,7 @@ export default defineComponent({
handleStopBot, handleStopBot,
handleStopBuy, handleStopBuy,
handleReloadConfig, handleReloadConfig,
handleForceSell, handleForceExit,
forcebuyShow, forcebuyShow,
botStore, botStore,
isRunning, isRunning,

View File

@ -590,7 +590,7 @@ export function createBotSubStore(botId: string, botName: string) {
return Promise.reject(error); return Promise.reject(error);
} }
}, },
async forcesell(payload: ForceSellPayload) { async forceexit(payload: ForceSellPayload) {
try { try {
const res = await api.post<ForceSellPayload, AxiosResponse<StatusResponse>>( const res = await api.post<ForceSellPayload, AxiosResponse<StatusResponse>>(
'/forcesell', '/forcesell',

View File

@ -288,13 +288,10 @@ export const useBotStore = defineStore('wrapper', {
}); });
}, },
async forceSellMulti(forcesellPayload: MultiForcesellPayload) { async forceSellMulti(forcesellPayload: MultiForcesellPayload) {
// return dispatch(`${forcesellPayload.botId}/${[BotStoreActions.forcesell]}`, forcesellPayload); return this.botStores[forcesellPayload.botId].forceexit(forcesellPayload);
}, },
async deleteTradeMulti(deletePayload: MultiDeletePayload) { async deleteTradeMulti(deletePayload: MultiDeletePayload) {
// return dispatch( return this.botStores[deletePayload.botId].deleteTrade(deletePayload.tradeid);
// `${deletePayload.botId}/${[BotStoreActions.deleteTrade]}`,
// deletePayload.tradeid,
// );
}, },
}, },
}); });