feat: add hyperopt-loss list endpoint
Some checks failed
FreqUI CI / build (18, ubuntu-22.04) (push) Has been cancelled
FreqUI CI / build (20, ubuntu-22.04) (push) Has been cancelled
FreqUI CI / build (22, ubuntu-22.04) (push) Has been cancelled
FreqUI CI / build (23, ubuntu-22.04) (push) Has been cancelled

This commit is contained in:
Matthias 2024-10-25 06:11:45 +02:00
parent 31468f7716
commit e4811a97b0
2 changed files with 23 additions and 0 deletions

View File

@ -52,6 +52,8 @@ import {
EntryStats,
PairIntervalTuple,
PairHistory,
HyperoptLossListResponse,
HyperoptLossObj,
} from '@/types';
import axios, { AxiosResponse } from 'axios';
import { useWebSocket } from '@vueuse/core';
@ -106,6 +108,7 @@ export function createBotSubStore(botId: string, botName: string) {
strategyPlotConfig: undefined as PlotConfig | undefined,
strategyList: [] as string[],
freqaiModelList: [] as string[],
hyperoptLossList: [] as HyperoptLossObj[],
exchangeList: [] as Exchange[],
strategy: {} as StrategyResult,
pairlist: [] as string[],
@ -504,6 +507,17 @@ export function createBotSubStore(botId: string, botName: string) {
return Promise.reject(error);
}
},
async getHyperoptLossList() {
try {
// Only available starting with 2.40
const { data } = await api.get<HyperoptLossListResponse>('/hyperopt-loss');
this.hyperoptLossList = data.loss_functions;
return Promise.resolve(data);
} catch (error) {
console.error(error);
return Promise.reject(error);
}
},
async getExchangeList() {
try {
const { data } = await api.get<ExchangeListResult>('/exchanges');

View File

@ -189,6 +189,15 @@ export interface FreqAIModelListResult {
freqaimodels: string[];
}
export interface HyperoptLossObj {
name: string;
description: string;
}
export interface HyperoptLossListResponse {
loss_functions: HyperoptLossObj[];
}
export interface SysInfoResponse {
cpu_pct: number[];
ram_pct: number;