added blacklist configuration

This commit is contained in:
Tako 2023-05-30 11:28:55 +00:00
parent ee8db64f28
commit 5e927d406e
3 changed files with 65 additions and 3 deletions

View File

@ -0,0 +1,48 @@
<template>
<b-card no-body class="mb-2">
<template #header>
<div class="d-flex text-start align-items-center">
<div class="d-flex flex-grow-1 align-items-center">
<div
role="button"
class="d-flex flex-grow-1 align-items-center flex-column"
@click="visible = !visible"
>
<span class="fw-bold fd-italic">Blacklist</span>
</div>
</div>
</div>
</template>
<b-card-body :class="{ hidden: !visible }">
<b-collapse v-model="visible">
<b-input-group v-for="(item, i) in pairlistStore.blacklist" :key="i" class="mb-2">
<b-form-input v-model="pairlistStore.blacklist[i]" />
<b-input-group-append>
<b-button size="sm" @click="pairlistStore.removeFromBlacklist(i)"
><i-mdi-close
/></b-button>
</b-input-group-append>
</b-input-group>
<b-button @click="pairlistStore.addToBlacklist()">Add</b-button>
</b-collapse>
</b-card-body>
</b-card>
</template>
<script setup>
import { ref } from 'vue';
import { usePairlistConfigStore } from '@/stores/pairlistConfig';
const pairlistStore = usePairlistConfigStore();
const visible = ref(false);
</script>
<style lang="scss" scoped>
.hidden {
padding: 0;
}
:deep(.collapsing) {
-webkit-transition: none;
transition: none;
display: none;
}
</style>

View File

@ -64,6 +64,7 @@
</b-button>
</template>
</b-input-group>
<PairlistConfigBlacklist />
<b-alert
:model-value="
pairlistStore.config.pairlists.length > 0 && !pairlistStore.firstPairlistIsGenerator
@ -95,7 +96,8 @@ import { computed, onMounted, ref } from 'vue';
import { useBotStore } from '@/stores/ftbotwrapper';
import { usePairlistConfigStore } from '@/stores/pairlistConfig';
import PairlistConfigItem from './PairlistConfigItem.vue';
import { Pairlist, PairlistConfig, PairlistParamType, PairlistPayloadItem } from '@/types';
import PairlistConfigBlacklist from './PairlistConfigBlacklist.vue';
import { Pairlist, PairlistParamType, PairlistPayloadItem } from '@/types';
import { useSortable, moveArrayElement } from '@vueuse/integrations/useSortable';
import CopyableTextfield from '@/components/general/CopyableTextfield.vue';
@ -178,7 +180,7 @@ function configToPayload() {
return {
pairlists: pairlists,
stake_currency: botStore.activeBot.stakeCurrency,
blacklist: [],
blacklist: pairlistStore.blacklist,
};
}

View File

@ -13,6 +13,7 @@ export const usePairlistConfigStore = defineStore(
const evaluating = ref<boolean>(false);
const intervalId = ref<number>();
const whitelist = ref<string[]>([]);
const blacklist = ref<string[]>([]);
const config = ref<PairlistConfig>({ name: '', pairlists: [] });
const savedConfigs = ref<PairlistConfig[]>([]);
@ -78,17 +79,28 @@ export const usePairlistConfigStore = defineStore(
config.value = structuredClone(toRaw(selected));
}
function addToBlacklist() {
blacklist.value.push('');
}
function removeFromBlacklist(index: number) {
blacklist.value.splice(index, 1);
}
return {
evaluating,
whitelist,
config,
savedConfigs,
blacklist,
startPairlistEvaluation,
addToConfig,
removeFromConfig,
saveConfig,
selectConfig,
newConfig,
addToBlacklist,
removeFromBlacklist,
firstPairlistIsGenerator,
pairlistValid,
};
@ -96,7 +108,7 @@ export const usePairlistConfigStore = defineStore(
{
persist: {
key: 'pairlist-configs',
paths: ['savedConfigs'],
paths: ['savedConfigs', 'blacklist'],
},
},
);