@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / PriceFeedConfig

Interface: PriceFeedConfig

Defined in: packages/sdk/src/config.ts:195

The realtime price-feed endpoint — the standalone EMA price-feed indexer (Hasura GraphQL). ONE endpoint serves every tracked asset (BTC/USDC, ETH/USDC, …); callers select an asset by filter. Snapshot + history read over HTTP; live prices stream over a Hasura WebSocket subscription.

Properties

url

url: string

Defined in: packages/sdk/src/config.ts:197

HTTP GraphQL endpoint (snapshot + history + candles, all assets).


wsUrl?

optional wsUrl?: string

Defined in: packages/sdk/src/config.ts:202

WebSocket GraphQL endpoint for live subscriptions. Derived from url (http→ws, https→wss) when omitted.


quote?

optional quote?: string

Defined in: packages/sdk/src/config.ts:223

Quote asset to pin every read to (e.g. "USDC"), case-insensitive. The feed indexes SEVERAL quotes per base (BTC/USDC, BTC/USDT), so base alone is no longer a unique feed key: leaving this unset matches every quote, which double-counts a base that trades against more than one quote — duplicate candle buckets (a hard error in charting libs that require strictly ascending, unique timestamps), an arbitrary Feed/tick row per push.

Required for a live watch. watchPrice/watchPrices (and the price hooks and SomniaMarkets.watchPrice, which go through them) reject with a NotConfiguredError naming config.priceFeed.quote when it is unset. The tick tape streams on a requestId cursor, and one oracle request prices every symbol in the tick, so across quotes that cursor is not unique: a batch boundary between two rows sharing one would advance past the second and lose it. Unpinned reads double-count; an unpinned watch would drop data.

The one-shot reads (fetchPrice, fetchPriceHistory, fetchPriceOHLCV, fetchPrices, listPriceFeeds) still work unset, where double-counting is the only cost. Both shipped feed constants are pinned to USDC already.