Skip to Content
Symmio Trading-SDK — the SDK surface for builders on HyperEVM
CorePrice ServicewatchEnigmaPrices

watchEnigmaPrices

Subscribe to the chain’s Enigma lowcap price-service WebSocket and receive live mark-price ticks.

The endpoint is broadcast-only — there is no subscribe message; every connected client receives the same ticks. The service pushes batches of EnigmaPriceTick — your onPrices handler is called once per push with every market that ticked. Watchers sharing the same wsUrl share one underlying socket (pooled per wsUrl); it reconnects with exponential backoff and closes only when the last watcher unwatches.

This is a subscribe function, not a query — there are no query options. For a React binding, use the useEnigmaPrices hook.

import { watchEnigmaPrices } from "@symmio/trading-core"; const unwatch = watchEnigmaPrices(config, { onPrices: (ticks) => { for (const tick of ticks) { console.log(tick.name, tick.markPrice, tick.time); } }, onStatusChange: (status) => console.log("status:", status), onError: (err) => console.error("prices error:", err), }); // later, dispose (idempotent): unwatch();

Parameters

Called for every parsed batch of price ticks.

onStatusChange(s: SocketStatus) => voidoptional

Called whenever the underlying connection status changes. SocketStatus is "connecting" | "open" | "reconnecting" | "closing" | "closed".

onError(e: SymmError) => voidoptional

Called on a transport or parse error; does not stop the subscription.

chainIdnumberoptional

Target chain id. Defaults to the config’s defaultChainId.

Returns

Unwatch

Call to stop the subscription; idempotent. The pooled socket closes when the last watcher releases.

Throws

Throws a SymmError synchronously when the chain is unsupported, has no priceService.wsUrl configured (PRICES_WS_NOT_CONFIGURED), or no WebSocket implementation is available. Per-frame parse and transport failures surface on onError as a SymmError (PRICES_SOCKET_ERROR) and do not stop the subscription.

Last updated on