feat: saxo history
This commit is contained in:
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user