Use "reduced" pair_history endpoint

This commit is contained in:
Matthias 2024-04-28 15:58:16 +02:00
parent d51246d1d1
commit fa18c043c4
3 changed files with 20 additions and 6 deletions

View File

@ -192,6 +192,7 @@ function refresh() {
timerange: props.timerange, timerange: props.timerange,
strategy: props.strategy, strategy: props.strategy,
freqaimodel: props.freqaiModel, freqaimodel: props.freqaiModel,
columns: plotStore.usedColumns,
}); });
} else { } else {
botStore.activeBot.getPairCandles({ botStore.activeBot.getPairCandles({
@ -234,7 +235,7 @@ watch(
() => { () => {
// all plotstore.usedColumns are in the dataset // all plotstore.usedColumns are in the dataset
const hasAllColumns = plotStore.usedColumns.every((c) => datasetColumns.value.includes(c)); const hasAllColumns = plotStore.usedColumns.every((c) => datasetColumns.value.includes(c));
if (!props.historicView && settingsStore.useReducedPairCalls && !hasAllColumns) { if (settingsStore.useReducedPairCalls && !hasAllColumns) {
console.log('triggering refresh'); console.log('triggering refresh');
refresh(); refresh();
} }

View File

@ -394,16 +394,28 @@ export function createBotSubStore(botId: string, botName: string) {
if (payload.pair && payload.timeframe) { if (payload.pair && payload.timeframe) {
this.historyStatus = LoadingStatus.loading; this.historyStatus = LoadingStatus.loading;
try { try {
const { data } = await api.get('/pair_history', { const settingsStore = useSettingsStore();
params: { ...payload }, let result: PairHistory | null = null;
timeout: 50000, if (this.botApiVersion >= 2.35 && settingsStore.useReducedPairCalls) {
}); // Modern approach, allowing filtering of columns
const { data } = await api.post<PairHistoryPayload, AxiosResponse<PairHistory>>(
'/pair_history',
payload,
);
result = data;
} else {
const { data } = await api.get<PairHistory>('/pair_history', {
params: { ...payload },
timeout: 50000,
});
result = data;
}
this.history = { this.history = {
[`${payload.pair}__${payload.timeframe}`]: { [`${payload.pair}__${payload.timeframe}`]: {
pair: payload.pair, pair: payload.pair,
timeframe: payload.timeframe, timeframe: payload.timeframe,
timerange: payload.timerange, timerange: payload.timerange,
data: data, data: result,
}, },
}; };
this.historyStatus = LoadingStatus.success; this.historyStatus = LoadingStatus.success;

View File

@ -27,6 +27,7 @@ export interface PairHistoryPayload {
timerange: string; timerange: string;
strategy: string; strategy: string;
freqaimodel?: string; freqaimodel?: string;
columns?: string[];
} }
export interface PairHistory { export interface PairHistory {