frequi_origin/src/components/ftbot/BotControls.vue

104 lines
2.9 KiB
Vue
Raw Normal View History

2020-05-06 04:38:57 +00:00
<template>
<div class="container-fluid">
<div class="row">
<button
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading || isRunning"
title="Start Trading"
@click="startBot()"
>
2020-11-13 19:19:16 +00:00
<PlayIcon />
</button>
<button
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading || !isRunning"
title="Stop Trading - Also stops handling open trades."
@click="stopBot()"
>
2020-11-13 19:19:16 +00:00
<StopIcon />
</button>
<button
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading || !isRunning"
title="StopBuy - Stops buying, but still handles open trades"
@click="stopBuy()"
>
2020-11-13 19:19:16 +00:00
<PauseIcon />
</button>
<button
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading"
title="Reload Config - reloads configuration including strategy, resetting all settings changed on the fly."
@click="reloadConfig()"
>
2020-11-13 19:19:16 +00:00
<ReloadIcon />
2020-08-31 18:01:51 +00:00
</button>
2020-05-15 17:28:20 +00:00
<button
v-if="botState.forcebuy_enabled"
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm ml-1"
:disabled="!isTrading || !isRunning"
title="Force Buy - Immediately buy an asset at an optional price. Sells are then handled according to strategy rules."
2020-06-04 18:06:58 +00:00
@click="initiateForcebuy"
2020-05-15 17:28:20 +00:00
>
2020-11-13 19:19:16 +00:00
<ForceBuyIcon />
2020-05-14 16:10:57 +00:00
</button>
2020-11-08 10:08:27 +00:00
<button
2020-11-08 10:40:26 +00:00
v-if="isWebserverMode"
2020-11-08 10:08:27 +00:00
:disabled="isTrading"
2020-11-13 19:19:16 +00:00
class="btn btn-secondary btn-sm col-md-5 ml-1"
title="Start Trading mode"
2020-11-08 10:08:27 +00:00
@click="startTrade()"
>
2020-11-13 19:19:16 +00:00
<PlayIcon />
2020-11-08 10:08:27 +00:00
</button>
2020-08-31 15:43:44 +00:00
<ForceBuyForm :modal-show="forcebuyShow" @close="this.$bvModal.hide('forcebuy-modal')" />
2020-05-06 04:38:57 +00:00
</div>
</div>
</template>
2020-08-09 13:23:04 +00:00
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { namespace } from 'vuex-class';
2020-11-08 10:40:26 +00:00
import { BotState } from '@/types';
import { BotStoreGetters } from '@/store/modules/ftbot';
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';
import ForceBuyIcon from 'vue-material-design-icons/BankPlus.vue';
2020-05-14 16:10:57 +00:00
import ForceBuyForm from './ForceBuyForm.vue';
2020-05-06 04:38:57 +00:00
2020-08-09 13:23:04 +00:00
const ftbot = namespace('ftbot');
2020-11-13 19:19:16 +00:00
@Component({
components: { ForceBuyForm, PlayIcon, StopIcon, PauseIcon, ReloadIcon, ForceBuyIcon },
})
2020-08-09 13:23:04 +00:00
export default class BotControls extends Vue {
forcebuyShow = false;
2020-08-15 15:31:29 +00:00
@ftbot.State botState!: BotState;
2020-08-09 13:23:04 +00:00
@ftbot.Action startBot;
@ftbot.Action stopBot;
@ftbot.Action stopBuy;
@ftbot.Action reloadConfig;
2020-11-08 10:08:27 +00:00
@ftbot.Action startTrade;
2020-11-08 10:40:26 +00:00
@ftbot.Getter [BotStoreGetters.isTrading]!: boolean;
@ftbot.Getter [BotStoreGetters.isWebserverMode]!: boolean;
get isRunning(): boolean {
return this.botState.state === 'running';
}
2020-08-09 13:23:04 +00:00
initiateForcebuy() {
this.$bvModal.show('forcebuy-modal');
}
}
2020-05-06 04:38:57 +00:00
</script>