Constructs a new SwitchboardSurgeTask.
Optionalproperties: 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
StaticcreateCreates a new SwitchboardSurgeTask instance using the specified properties.
Optionalproperties: ISwitchboardSurgeTaskProperties to set
SwitchboardSurgeTask instance
StaticdecodeDecodes a SwitchboardSurgeTask message from the specified reader or buffer.
Reader or buffer to decode from
Optionallength: numberMessage length if known beforehand
SwitchboardSurgeTask
StaticdecodeDecodes a SwitchboardSurgeTask message from the specified reader or buffer, length delimited.
Reader or buffer to decode from
SwitchboardSurgeTask
StaticencodeEncodes the specified SwitchboardSurgeTask message. Does not implicitly {@apilink oracle_job.OracleJob.SwitchboardSurgeTask.verify|verify} messages.
SwitchboardSurgeTask message or plain object to encode
Optionalwriter: WriterWriter to encode to
Writer
StaticencodeEncodes the specified SwitchboardSurgeTask message, length delimited. Does not implicitly {@apilink oracle_job.OracleJob.SwitchboardSurgeTask.verify|verify} messages.
SwitchboardSurgeTask message or plain object to encode
Optionalwriter: WriterWriter to encode to
Writer
StaticfromCreates a SwitchboardSurgeTask message from a plain object. Also converts values to their respective internal types.
Plain object
SwitchboardSurgeTask
StaticgetGets the default type url for SwitchboardSurgeTask
OptionaltypeUrlPrefix: stringyour custom typeUrlPrefix(default "type.googleapis.com")
The default type url
StatictoCreates a plain object from a SwitchboardSurgeTask message. Also converts values to other types if specified.
SwitchboardSurgeTask
Optionaloptions: IConversionOptionsConversion options
Plain object
StaticverifyVerifies 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).