Skip to main content

SwitchboardSurgeTask

Fetch a live spot price straight out of the global Surge websocket cache – the same cache that powers our high-speed on-chain oracles.

Inputsymbol – the trading-pair symbol as it appears on the exchange • source – which exchange’s stream to read from • BINANCE (weight 3) • BYBIT (weight 2) • OKX (weight 2) • COINBASE (weight 1) • WEIGHTED (default) – use the weighted median of all fresh quotes (<= 5 s old) with the weights shown above.

Returns The most recent price available from the chosen source. The task fails if the cached tick is older than 5 s.

Example: Pull the Binance price for BTC / USDT

{
"switchboardSurgeTask": {
"source": "BINANCE",
"symbol": "BTCUSDT"
}
}

Example: Use the weighted-median oracle for BTC / USDT

{
"switchboardSurgeTask": {
"source": "WEIGHTED", // or omit — WEIGHTED is the default
"symbol": "BTCUSDT"
}
}

Notes • Symbols are auto-normalised (case-insensitive, punctuation removed). • If a venue’s price is stale (> 5 s) it is ignored in the WEIGHTED calculation. The task errors if no fresh price remains. • The weighted-median algorithm is the same one Hyperliquid uses in production: cumulative weights 3 / 2 / 2 / 1 / 1 / 1 / 1 / 1 across the eight venues (we currently stream the first four).


Fields

NameTypeDescription
 source

Determines which source will be used for pricing. Default: WEIGHTED average across all sources.

 symbol

string

Enums

 Source

ValueNameDescription
 0WEIGHTED
 1BINANCE
 2OKX
 3BYBIT
 4COINBASE