feat: saxo history

This commit is contained in:
OpenSquared
2026-07-18 18:26:07 +02:00
parent 6cfa36b710
commit ff242bd2a6
9 changed files with 258 additions and 20 deletions

View File

@@ -1714,9 +1714,27 @@ export type SaxoSnapshotRow = {
created_at: string
}
export const useSaxoHistory = (symbol?: string) =>
export const useSaxoHistory = (symbol?: string, dateFrom?: string, dateTo?: string) =>
useQuery<SaxoSnapshotRow[]>({
queryKey: ['saxo-history', symbol],
queryFn: () => api.get('/saxo/history', { params: symbol ? { symbol } : {} }).then(r => r.data),
enabled: !!symbol,
queryKey: ['saxo-history', symbol, dateFrom, dateTo],
queryFn: () => api.get('/saxo/history', {
params: { ...(symbol ? { symbol } : {}), ...(dateFrom ? { date_from: dateFrom } : {}), ...(dateTo ? { date_to: dateTo } : {}) },
}).then(r => r.data),
})
export type SaxoSymbolSummary = { symbol: string; rows_count: number; first_date: string; last_date: string }
export const useSaxoSymbols = () =>
useQuery<SaxoSymbolSummary[]>({
queryKey: ['saxo-symbols'],
queryFn: () => api.get('/saxo/symbols').then(r => r.data),
})
export type SaxoValidation = { symbol: string; valid: boolean; uic: number | null; error: string | null }
export const useValidateSaxoWatchlist = () =>
useQuery<SaxoValidation[]>({
queryKey: ['saxo-validate'],
queryFn: () => api.get('/saxo/validate').then(r => r.data),
enabled: false,
})