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 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": "BTC/FDUSD"
}
}

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

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

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).

Implements

Constructors

Properties

source: Source

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

symbol: string

SwitchboardSurgeTask symbol.

Methods

  • Converts this SwitchboardSurgeTask to JSON.

    Returns { [k: string]: any }

    JSON object

  • Decodes a SwitchboardSurgeTask message from the specified reader or buffer.

    Parameters

    • reader: Uint8Array<ArrayBufferLike> | Reader

      Reader or buffer to decode from

    • Optionallength: number

      Message length if known beforehand

    Returns OracleJob.SwitchboardSurgeTask

    SwitchboardSurgeTask

    If the payload is not a reader or valid buffer

    If required fields are missing

  • Decodes a SwitchboardSurgeTask message from the specified reader or buffer, length delimited.

    Parameters

    • reader: Uint8Array<ArrayBufferLike> | Reader

      Reader or buffer to decode from

    Returns OracleJob.SwitchboardSurgeTask

    SwitchboardSurgeTask

    If the payload is not a reader or valid buffer

    If required fields are missing

  • Encodes the specified SwitchboardSurgeTask message. Does not implicitly {@apilink oracle_job.OracleJob.SwitchboardSurgeTask.verify|verify} messages.

    Parameters

    • message: ISwitchboardSurgeTask

      SwitchboardSurgeTask message or plain object to encode

    • Optionalwriter: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Encodes the specified SwitchboardSurgeTask message, length delimited. Does not implicitly {@apilink oracle_job.OracleJob.SwitchboardSurgeTask.verify|verify} messages.

    Parameters

    • message: ISwitchboardSurgeTask

      SwitchboardSurgeTask message or plain object to encode

    • Optionalwriter: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Creates a SwitchboardSurgeTask message from a plain object. Also converts values to their respective internal types.

    Parameters

    • object: { [k: string]: any }

      Plain object

    Returns OracleJob.SwitchboardSurgeTask

    SwitchboardSurgeTask

  • Gets the default type url for SwitchboardSurgeTask

    Parameters

    Returns string

    The default type url

  • Creates a plain object from a SwitchboardSurgeTask message. Also converts values to other types if specified.

    Parameters

    Returns { [k: string]: any }

    Plain object

  • Verifies a SwitchboardSurgeTask message.

    Parameters

    • message: { [k: string]: any }

      Plain object to verify

    Returns null | string

    null if valid, otherwise the reason why it is not