feat: saxo price

This commit is contained in:
OpenSquared
2026-07-23 10:46:24 +02:00
parent a136d6ae11
commit 7267443d5b
4 changed files with 31 additions and 7 deletions

View File

@@ -338,9 +338,20 @@ function RiskProfilesCard() {
// scheduler's watchlist (Config -> Saxo below) so it gets snapshotted.
// 'quote' — which Saxo spot/futures symbol prices this instrument in the Cockpit,
// replacing yfinance's unadjusted continuous-futures tickers.
// Asset-type filters matching backend services.saxo_client.OPTION_ASSET_TYPES /
// UNDERLYING_ASSET_TYPES — keeps each picker's search scoped to the catalog rows that
// are actually relevant, instead of both searching the same undifferentiated list.
const SAXO_LINK_KIND_META = {
option: { label: 'Option', placeholder: 'Search Saxo option symbol…', activeCls: 'text-emerald-400 hover:text-emerald-300 bg-emerald-900/20 border-emerald-700/30' },
quote: { label: 'Quote', placeholder: 'Search Saxo spot/futures symbol…', activeCls: 'text-sky-400 hover:text-sky-300 bg-sky-900/20 border-sky-700/30' },
option: {
label: 'Option', placeholder: 'Search Saxo option symbol…',
activeCls: 'text-emerald-400 hover:text-emerald-300 bg-emerald-900/20 border-emerald-700/30',
assetTypes: 'FuturesOption,FxVanillaOption,StockOption,StockIndexOption',
},
quote: {
label: 'Quote', placeholder: 'Search Saxo spot/futures symbol…',
activeCls: 'text-sky-400 hover:text-sky-300 bg-sky-900/20 border-sky-700/30',
assetTypes: 'ContractFutures,FxSpot,StockIndex',
},
} as const
function SaxoLinkPicker({ ticker, kind, saxoSymbol }: { ticker: string; kind: keyof typeof SAXO_LINK_KIND_META; saxoSymbol: string | null }) {
@@ -350,8 +361,8 @@ function SaxoLinkPicker({ ticker, kind, saxoSymbol }: { ticker: string; kind: ke
const optionLink = useSetWatchlistSaxoOptionLink()
const quoteLink = useSetWatchlistSaxoQuoteLink()
const { mutate: setLink, isPending } = kind === 'option' ? optionLink : quoteLink
const { data: catalogMatches } = useSaxoCatalog(undefined, value.length >= 2 ? value : undefined)
const meta = SAXO_LINK_KIND_META[kind]
const { data: catalogMatches } = useSaxoCatalog(meta.assetTypes, value.length >= 2 ? value : undefined)
const save = (sym?: string) => {
const resolved = (sym ?? value).trim().toUpperCase() || null