feat: saxo price

This commit is contained in:
OpenSquared
2026-07-23 10:33:18 +02:00
parent 1ac2270271
commit a136d6ae11
5 changed files with 118 additions and 40 deletions

View File

@@ -151,11 +151,14 @@ export const useRemoveWatchlistInstrument = () => {
})
}
export const useSetWatchlistSaxoLink = () => {
// Which Saxo OPTIONS CHAIN Options Lab should analyze for this underlying (e.g.
// CL=F -> MCL:XCME) — independent of useSetWatchlistSaxoQuoteLink below, often a
// different Saxo instrument.
export const useSetWatchlistSaxoOptionLink = () => {
const qc = useQueryClient()
return useMutation({
mutationFn: ({ ticker, saxoSymbol }: { ticker: string; saxoSymbol: string | null }) =>
api.put(`/watchlist/${encodeURIComponent(ticker)}/saxo-link`, { saxo_symbol: saxoSymbol }).then(r => r.data),
api.put(`/watchlist/${encodeURIComponent(ticker)}/saxo-option-link`, { saxo_symbol: saxoSymbol }).then(r => r.data),
onSuccess: () => {
qc.invalidateQueries({ queryKey: ['instruments-watchlist'] })
qc.invalidateQueries({ queryKey: ['instruments-watchlist-quotes'] })
@@ -165,6 +168,20 @@ export const useSetWatchlistSaxoLink = () => {
})
}
// Which Saxo spot/futures symbol prices this instrument in the Cockpit, instead of
// yfinance's unadjusted continuous-futures tickers.
export const useSetWatchlistSaxoQuoteLink = () => {
const qc = useQueryClient()
return useMutation({
mutationFn: ({ ticker, saxoSymbol }: { ticker: string; saxoSymbol: string | null }) =>
api.put(`/watchlist/${encodeURIComponent(ticker)}/saxo-quote-link`, { saxo_symbol: saxoSymbol }).then(r => r.data),
onSuccess: () => {
qc.invalidateQueries({ queryKey: ['instruments-watchlist'] })
qc.invalidateQueries({ queryKey: ['instruments-watchlist-quotes'] })
},
})
}
// Latest cycle report — shares the 'cycle-report-latest' queryKey with RapportIA.tsx
export const useLatestCycleReport = () =>
useQuery({