Add forcesell all button to botcontrols

This commit is contained in:
Matthias 2022-01-22 13:04:12 +01:00
parent b272db088a
commit 136f7a8267
2 changed files with 35 additions and 6 deletions

View File

@ -32,6 +32,14 @@
> >
<ReloadIcon /> <ReloadIcon />
</button> </button>
<button
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading"
title="Forcesell all"
@click="handleForceSell()"
>
<ForceSellIcon />
</button>
<button <button
v-if="botState && botState.forcebuy_enabled" v-if="botState && botState.forcebuy_enabled"
class="btn btn-secondary btn-sm ml-1" class="btn btn-secondary btn-sm ml-1"
@ -57,12 +65,13 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator'; import { Component, Vue } from 'vue-property-decorator';
import { namespace } from 'vuex-class'; import { namespace } from 'vuex-class';
import { BotState } from '@/types'; import { BotState, ForceSellPayload } from '@/types';
import { BotStoreGetters } from '@/store/modules/ftbot'; import { BotStoreActions, BotStoreGetters } from '@/store/modules/ftbot';
import PlayIcon from 'vue-material-design-icons/Play.vue'; 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 ForceBuyIcon from 'vue-material-design-icons/PlusBoxMultipleOutline.vue'; import ForceBuyIcon from 'vue-material-design-icons/PlusBoxMultipleOutline.vue';
import StoreModules from '@/store/storeSubModules'; import StoreModules from '@/store/storeSubModules';
import ForceBuyForm from './ForceBuyForm.vue'; import ForceBuyForm from './ForceBuyForm.vue';
@ -70,7 +79,15 @@ import ForceBuyForm from './ForceBuyForm.vue';
const ftbot = namespace(StoreModules.ftbot); const ftbot = namespace(StoreModules.ftbot);
@Component({ @Component({
components: { ForceBuyForm, PlayIcon, StopIcon, PauseIcon, ReloadIcon, ForceBuyIcon }, components: {
ForceBuyForm,
PlayIcon,
StopIcon,
PauseIcon,
ReloadIcon,
ForceSellIcon,
ForceBuyIcon,
},
}) })
export default class BotControls extends Vue { export default class BotControls extends Vue {
forcebuyShow = false; forcebuyShow = false;
@ -87,6 +104,9 @@ export default class BotControls extends Vue {
@ftbot.Action startTrade; @ftbot.Action startTrade;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ftbot.Action [BotStoreActions.forcesell]!: (payload: ForceSellPayload) => void;
@ftbot.Getter [BotStoreGetters.isTrading]!: boolean; @ftbot.Getter [BotStoreGetters.isTrading]!: boolean;
@ftbot.Getter [BotStoreGetters.isWebserverMode]!: boolean; @ftbot.Getter [BotStoreGetters.isWebserverMode]!: boolean;
@ -124,5 +144,16 @@ export default class BotControls extends Vue {
} }
}); });
} }
handleForceSell() {
this.$bvModal.msgBoxConfirm(`Really forcesell ALL trades?`).then((value) => {
console.log(value);
const payload: ForceSellPayload = {
tradeid: 'all',
// TODO: support ordertype (?)
};
this.forcesell(payload);
});
}
} }
</script> </script>

View File

@ -78,8 +78,6 @@ import { namespace } from 'vuex-class';
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
import { formatPercent, formatPrice } from '@/shared/formatters'; import { formatPercent, formatPrice } from '@/shared/formatters';
import { MultiDeletePayload, MultiForcesellPayload, Trade } from '@/types'; import { MultiDeletePayload, MultiForcesellPayload, Trade } from '@/types';
import DeleteIcon from 'vue-material-design-icons/Delete.vue';
import ForceSellIcon from 'vue-material-design-icons/CloseBoxMultiple.vue';
import ActionIcon from 'vue-material-design-icons/GestureTap.vue'; import ActionIcon from 'vue-material-design-icons/GestureTap.vue';
import DateTimeTZ from '@/components/general/DateTimeTZ.vue'; import DateTimeTZ from '@/components/general/DateTimeTZ.vue';
import { BotStoreGetters } from '@/store/modules/ftbot'; import { BotStoreGetters } from '@/store/modules/ftbot';
@ -90,7 +88,7 @@ import TradeActions from './TradeActions.vue';
const ftbot = namespace(StoreModules.ftbot); const ftbot = namespace(StoreModules.ftbot);
@Component({ @Component({
components: { DeleteIcon, ForceSellIcon, ActionIcon, DateTimeTZ, TradeProfit, TradeActions }, components: { ActionIcon, DateTimeTZ, TradeProfit, TradeActions },
}) })
export default class TradeList extends Vue { export default class TradeList extends Vue {
$refs!: { $refs!: {