Constructs a new SwitchboardSurgeTask.
Optional
properties: ISwitchboardSurgeTaskProperties to set
Determines which source will be used for pricing. Default: WEIGHTED average across all sources.
SwitchboardSurgeTask symbol.
Converts this SwitchboardSurgeTask to JSON.
JSON object
Static
createCreates a new SwitchboardSurgeTask instance using the specified properties.
Optional
properties: ISwitchboardSurgeTaskProperties to set
SwitchboardSurgeTask instance
Static
decodeDecodes a SwitchboardSurgeTask message from the specified reader or buffer.
Reader or buffer to decode from
Optional
length: numberMessage length if known beforehand
SwitchboardSurgeTask
Static
decodeDecodes a SwitchboardSurgeTask message from the specified reader or buffer, length delimited.
Reader or buffer to decode from
SwitchboardSurgeTask
Static
encodeEncodes the specified SwitchboardSurgeTask message. Does not implicitly {@apilink oracle_job.OracleJob.SwitchboardSurgeTask.verify|verify} messages.
SwitchboardSurgeTask message or plain object to encode
Optional
writer: WriterWriter to encode to
Writer
Static
encodeEncodes the specified SwitchboardSurgeTask message, length delimited. Does not implicitly {@apilink oracle_job.OracleJob.SwitchboardSurgeTask.verify|verify} messages.
SwitchboardSurgeTask message or plain object to encode
Optional
writer: WriterWriter to encode to
Writer
Static
fromCreates a SwitchboardSurgeTask message from a plain object. Also converts values to their respective internal types.
Plain object
SwitchboardSurgeTask
Static
getGets the default type url for SwitchboardSurgeTask
Optional
typeUrlPrefix: stringyour custom typeUrlPrefix(default "type.googleapis.com")
The default type url
Static
toCreates a plain object from a SwitchboardSurgeTask message. Also converts values to other types if specified.
SwitchboardSurgeTask
Optional
options: IConversionOptionsConversion options
Plain object
Static
verifyVerifies a SwitchboardSurgeTask message.
Plain object to verify
null
if valid, otherwise the reason why it is not
Fetch a live spot price straight out of the global Surge websocket cache – the same cache that powers our high-speed on-chain oracles.
Input •
symbol
– 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 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
Example: Use the weighted-median oracle for BTC / USDT
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).