From 8e5e56dd6769bf5a47cb1315d56b6bcae6d2f8af Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 20 Nov 2024 20:50:52 +0100 Subject: [PATCH] feat: Add initial sample for pair templates --- src/auto-imports.d.ts | 2 ++ src/components/ftbot/DownloadDataMain.vue | 17 +++++++++++++++++ src/composables/pairTemplates.ts | 16 ++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 src/composables/pairTemplates.ts diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts index 2e48f984..7e3e3ee6 100644 --- a/src/auto-imports.d.ts +++ b/src/auto-imports.d.ts @@ -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 readonly useOnline: UnwrapRef readonly usePageLeave: UnwrapRef + readonly usePairTemplates: UnwrapRef readonly usePairlistConfigStore: UnwrapRef readonly useParallax: UnwrapRef readonly useParentElement: UnwrapRef diff --git a/src/components/ftbot/DownloadDataMain.vue b/src/components/ftbot/DownloadDataMain.vue index c4036564..4883cd1c 100644 --- a/src/components/ftbot/DownloadDataMain.vue +++ b/src/components/ftbot/DownloadDataMain.vue @@ -5,6 +5,8 @@ const botStore = useBotStore(); const pairs = ref(['XRP/USDT', 'BTC/USDT']); const timeframes = ref(['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() { +
+ + {{ pt.description }} + +
diff --git a/src/composables/pairTemplates.ts b/src/composables/pairTemplates.ts new file mode 100644 index 00000000..5e8498bb --- /dev/null +++ b/src/composables/pairTemplates.ts @@ -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 }))), + }; +}