feat: saxo price
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user