diff --git a/src/components/ftbot/PairlistConfigItem.vue b/src/components/ftbot/PairlistConfigItem.vue new file mode 100644 index 00000000..a87a2288 --- /dev/null +++ b/src/components/ftbot/PairlistConfigItem.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/src/components/ftbot/PairlistConfigurator.vue b/src/components/ftbot/PairlistConfigurator.vue new file mode 100644 index 00000000..b27fc135 --- /dev/null +++ b/src/components/ftbot/PairlistConfigurator.vue @@ -0,0 +1,117 @@ + + + diff --git a/src/components/general/PairlistConfigParameter.vue b/src/components/general/PairlistConfigParameter.vue new file mode 100644 index 00000000..15728293 --- /dev/null +++ b/src/components/general/PairlistConfigParameter.vue @@ -0,0 +1,51 @@ + + + diff --git a/src/components/layout/NavBar.vue b/src/components/layout/NavBar.vue index 20da8173..8298f313 100644 --- a/src/components/layout/NavBar.vue +++ b/src/components/layout/NavBar.vue @@ -23,6 +23,9 @@ Backtest + Pairlist Config diff --git a/src/router/index.ts b/src/router/index.ts index 04eb7e9d..d543fe84 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -67,6 +67,11 @@ const routes: Array = [ allowAnonymous: true, }, }, + { + path: '/pairlist_config', + name: 'Pairlist Configuration', + component: () => import('@/views/PairlistConfigView.vue'), + }, { path: '/(.*)*', name: '404', diff --git a/src/stores/ftbot.ts b/src/stores/ftbot.ts index ed12ef2b..87f0f779 100644 --- a/src/stores/ftbot.ts +++ b/src/stores/ftbot.ts @@ -42,7 +42,12 @@ import { showAlert } from './alerts'; import { useWebSocket } from '@vueuse/core'; import { FTWsMessage, FtWsMessageTypes } from '@/types/wsMessageTypes'; import { showNotification } from '@/shared/notifications'; -import { FreqAIModelListResult } from '../types/types'; +import { + FreqAIModelListResult, + PairlistEvalResponse, + PairlistsPayload, + PairlistsResponse, +} from '../types/types'; export function createBotSubStore(botId: string, botName: string) { const userService = useUserService(botId); @@ -535,6 +540,24 @@ export function createBotSubStore(botId: string, botName: string) { return Promise.reject(error); } }, + async getPairlists() { + try { + const { data } = await api.get('/pairlists/available'); + return Promise.resolve(data); + } catch (error) { + console.error(error); + return Promise.reject(error); + } + }, + async getPairlistEvalStatus() { + try { + const { data } = await api.get('/pairlists/evaluate'); + return Promise.resolve(data); + } catch (error) { + console.error(error); + return Promise.reject(error); + } + }, // // Post methods // // TODO: Migrate calls to API to a seperate module unrelated to pinia? async startBot() { @@ -938,6 +961,21 @@ export function createBotSubStore(botId: string, botName: string) { }, ); }, + async evaluatePairlist(payload: PairlistsPayload) { + try { + const { data } = await api.post>( + '/pairlists/evaluate', + payload, + ); + return Promise.resolve(data); + } catch (error) { + if (axios.isAxiosError(error)) { + console.error(error.response); + } + showAlert('Error testing pairlist', 'danger'); + return Promise.reject(error); + } + }, }, }); diff --git a/src/types/types.ts b/src/types/types.ts index e51a3186..5661ff83 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -271,3 +271,52 @@ export enum LoadingStatus { success, error, } + +export interface PairlistsResponse { + pairlists: Pairlist[]; +} + +export interface PairlistEvalResponse { + detail?: string; + method?: string[]; + whitelist?: string[]; +} + +export interface Pairlist { + id?: string; + is_pairlist_generator: boolean; + name: string; + params: Record; +} + +export interface PairlistConfig { + name: string; + pairlists: Pairlist[]; +} + +export enum PairlistParamType { + string = 'string', + number = 'number', + boolean = 'boolean', + option = 'option', +} + +export interface PairlistParameter { + description: string; + help: string; + type: PairlistParamType; + value?: string; + default: string; + options?: string[]; +} + +export interface PairlistPayloadItem { + method: string; + [key: string]: string | number | boolean; +} + +export interface PairlistsPayload { + pairlists: PairlistPayloadItem[]; + blacklist: string[]; + stake_currency: string; +} diff --git a/src/views/PairlistConfigView.vue b/src/views/PairlistConfigView.vue new file mode 100644 index 00000000..1fb0b496 --- /dev/null +++ b/src/views/PairlistConfigView.vue @@ -0,0 +1,108 @@ + + +