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 />
</button>
<button
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading"
title="Forcesell all"
@click="handleForceSell()"
>
<ForceSellIcon />
</button>
<button
v-if="botState && botState.forcebuy_enabled"
class="btn btn-secondary btn-sm ml-1"
@ -57,12 +65,13 @@
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { namespace } from 'vuex-class';
import { BotState } from '@/types';
import { BotStoreGetters } from '@/store/modules/ftbot';
import { BotState, ForceSellPayload } from '@/types';
import { BotStoreActions, BotStoreGetters } from '@/store/modules/ftbot';
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';
import ForceSellIcon from 'vue-material-design-icons/CloseBoxMultiple.vue';
import ForceBuyIcon from 'vue-material-design-icons/PlusBoxMultipleOutline.vue';
import StoreModules from '@/store/storeSubModules';
import ForceBuyForm from './ForceBuyForm.vue';
@ -70,7 +79,15 @@ import ForceBuyForm from './ForceBuyForm.vue';
const ftbot = namespace(StoreModules.ftbot);
@Component({
components: { ForceBuyForm, PlayIcon, StopIcon, PauseIcon, ReloadIcon, ForceBuyIcon },
components: {
ForceBuyForm,
PlayIcon,
StopIcon,
PauseIcon,
ReloadIcon,
ForceSellIcon,
ForceBuyIcon,
},
})
export default class BotControls extends Vue {
forcebuyShow = false;
@ -87,6 +104,9 @@ export default class BotControls extends Vue {
@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.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>

View File

@ -78,8 +78,6 @@ import { namespace } from 'vuex-class';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { formatPercent, formatPrice } from '@/shared/formatters';
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 DateTimeTZ from '@/components/general/DateTimeTZ.vue';
import { BotStoreGetters } from '@/store/modules/ftbot';
@ -90,7 +88,7 @@ import TradeActions from './TradeActions.vue';
const ftbot = namespace(StoreModules.ftbot);
@Component({
components: { DeleteIcon, ForceSellIcon, ActionIcon, DateTimeTZ, TradeProfit, TradeActions },
components: { ActionIcon, DateTimeTZ, TradeProfit, TradeActions },
})
export default class TradeList extends Vue {
$refs!: {