feat: Add initial sample for pair templates

This commit is contained in:
Matthias 2024-11-20 20:50:52 +01:00
parent 143f61eb54
commit 8e5e56dd67
3 changed files with 35 additions and 0 deletions

View File

@ -272,6 +272,7 @@ declare global {
const useOffsetPagination: typeof import('@vueuse/core')['useOffsetPagination']
const useOnline: typeof import('@vueuse/core')['useOnline']
const usePageLeave: typeof import('@vueuse/core')['usePageLeave']
const usePairTemplates: typeof import('./composables/pairTemplates')['usePairTemplates']
const usePairlistConfigStore: typeof import('./stores/pairlistConfig')['usePairlistConfigStore']
const useParallax: typeof import('@vueuse/core')['useParallax']
const useParentElement: typeof import('@vueuse/core')['useParentElement']
@ -649,6 +650,7 @@ declare module 'vue' {
readonly useOffsetPagination: UnwrapRef<typeof import('@vueuse/core')['useOffsetPagination']>
readonly useOnline: UnwrapRef<typeof import('@vueuse/core')['useOnline']>
readonly usePageLeave: UnwrapRef<typeof import('@vueuse/core')['usePageLeave']>
readonly usePairTemplates: UnwrapRef<typeof import('./composables/pairTemplates')['usePairTemplates']>
readonly usePairlistConfigStore: UnwrapRef<typeof import('./stores/pairlistConfig')['usePairlistConfigStore']>
readonly useParallax: UnwrapRef<typeof import('@vueuse/core')['useParallax']>
readonly useParentElement: UnwrapRef<typeof import('@vueuse/core')['useParentElement']>

View File

@ -5,6 +5,8 @@ const botStore = useBotStore();
const pairs = ref<string[]>(['XRP/USDT', 'BTC/USDT']);
const timeframes = ref<string[]>(['5m', '1h']);
const { pairTemplates } = usePairTemplates();
const exchange = ref({
customExchange: false,
selectedExchange: {
@ -19,6 +21,10 @@ const exchange = ref({
function addPair() {
pairs.value.push('');
}
function addPairs(_pairs: string[]) {
pairs.value.push(..._pairs);
}
function addTimeframe() {
timeframes.value.push('');
}
@ -54,6 +60,17 @@ async function startDownload() {
</div>
</div>
<BButton variant="primary" title="Add Pair" @click="addPair"><i-mdi-plus /></BButton>
<div class="d-flex flex-column gap-1">
<BButton
v-for="pt in pairTemplates"
:key="pt.idx"
variant="secondary"
:title="pt.pairs"
@click="addPairs(pt.pairs)"
>
{{ pt.description }}
</BButton>
</div>
</div>
<div class="d-flex flex-fill align-items-end gap-2">
<div class="d-flex flex-column flex-shrink">

View File

@ -0,0 +1,16 @@
const pairTemplates = ref([
{
description: 'All USDT Pairs',
pairs: ['.*/USDT'],
},
{
description: 'All USDT Futures Pairs',
pairs: ['.*/USDT:USDT'],
},
]);
export function usePairTemplates() {
return {
pairTemplates: computed(() => pairTemplates.value.map((x, idx) => ({ ...x, idx }))),
};
}