Skip to Content
Symmio Trading-SDK — the SDK surface for builders on HyperEVM
CoreTP/SLwatchTpSlNotifications

watchTpSlNotifications

Subscribe to live TP/SL notifications for one SubAccount.

Reuses the defilytics-protocol subscribe-frame builder and the SDK’s shared socket pool, so many watchers across the app share one underlying connection per (wsUrl, appName, account) triple. The channel is scoped by the chain’s tpsl.appName (e.g. Hyper-EVM_COH-Low-Cap_Production), distinct from the quote-state notifications stream. Inbound report frames are parsed by parseTpSlFrame into TpSlNotifications before your handler fires.

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

import { watchTpSlNotifications } from "@symmio/trading-core"; const unwatch = watchTpSlNotifications(config, { account: subAccount, onNotification: (frame) => { console.log(frame.conditionalOrderType, frame.state, frame.successful); }, onStatusChange: (status) => console.log(status), onError: (err) => console.error(err), }); // later, dispose (idempotent): unwatch();

Parameters

accountAddressrequired

SubAccount address to subscribe for.

onNotification(n: TpSlNotification) => voidrequired

Called for every normalized TP/SL report.

chainIdnumberoptional

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

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.

Returns

UnwatchTpSl

An idempotent disposer. Call it to stop the subscription; the pooled socket closes when the last watcher releases.

Throws

Throws a SymmError synchronously when the chain has no tpsl config or no WebSocket implementation is available.

Last updated on