Exchange and symbol format

View as MarkdownOpen the editor

The exchange ids and the venue-native symbol spellings a wrun indicator uses where the file names a market: a pinned input's symbol and exchange. The vocabulary is the chart's own: an exchange id in uppercase, and the symbol as that venue spells it.

Where the vocabulary is used

A market is the pair exchange + symbol, and in the file the two travel together:

  • Pinned inputs. input("btc", ohlcv.close, { symbol: "BTCUSDT", exchange: "BINANCE_FUTURES" }). The chart passes both as written, in its own ids, and serves a market pin on a secondary ohlcv input: it fetches that market's candles at the chart's interval (or at a coarser pinned interval) and joins them to the chart's bars by timestamp. A lone symbol or a lone exchange is refused at the sheet check, because half a pin names a market that does not exist.
  • Polymarket odds. An odds input names its market by condition id in symbol alone; the exchange is implied, and writing one is refused.
  • Everything else follows the chart. An unpinned input reads the chart's own market, and the module never sees a market name: the chart supplies it. Trades, funding, open interest, liquidations, order books, and volume profiles always read the chart's own market.

Example: one market on three venues

Three pinned closes of the same asset, spelled the way each venue spells it, and two spreads between them. The first input stays unpinned, so the indicator follows whatever market the chart shows:

input("close", ohlcv.close);
// Every pin names the venue's own spelling of the market, and symbol and exchange always pin together.
input("binance_spot", ohlcv.close, { symbol: "BTCUSDT", exchange: "BINANCE", description: "Binance spot, joined form" });
input("binance_perp", ohlcv.close, { symbol: "BTCUSDT", exchange: "BINANCE_FUTURES", description: "Binance perpetual, joined form" });
input("coinbase", ohlcv.close, { symbol: "BTC-USD", exchange: "COINBASE", description: "Coinbase spot, hyphen form" });
output("basis_pct", line, lower, { unit: "%", description: "Binance perp premium over Binance spot" });
output("coinbase_gap_pct", line, lower, { unit: "%", description: "Coinbase spot over Binance spot" });

function onBar(): void {
  const spot = in_binance_spot();
  if (isNaN(spot) || spot <= 0.0) return;
  out_basis_pct(((in_binance_perp() - spot) / spot) * 100.0);
  out_coinbase_gap_pct(((in_coinbase() - spot) / spot) * 100.0);
}
BTCUSDT perpetual on Binance, 1 hour bars, Aug 10 to Aug 18, 2026Real output from OpenMarket's engine

The unpinned close is never read by the code; it is the grid every pinned input aligns to. To try it, press New indicator in the editor's Explorer, keep the //@lang=wrun-ts line, replace the starter under it with this file, and press Run: the two spreads draw in their own pane below the chart, at the chart's interval, on a crypto chart (a stock or forex chart's session bars open at other times: Stocks, forex and gold). An alert evaluates the pinned markets too (Alerts).

Exchange reference table

Exchange ids are the chart's own spelling, always uppercase. Symbols are venue-native: each venue's own separator, or none. The format column shows the venue's convention with an example market.

ExchangeCategorySymbol formatExample
BINANCESPOTBTCUSDTBitcoin to Tether (spot)
BINANCE_FUTURESPERPETUALBTCUSDTBTC/USDT perpetual
BINANCE_DELIVERYdated futuresvenue-nativeBTC dated contracts
BITFINEXSPOTBTCUST or BTC:USDBitcoin to USD (spot)
BITFINEX_DERIVATIVESPERPETUALBTCF0:USTF0BTC perpetual
BITGETPERPETUALBTCUSDTBTC/USDT perpetual
BITMEXPERPETUALXBTUSDBitcoin to USD
BITSTAMPSPOTBTCUSDBitcoin to USD (spot)
BYBITPERPETUALBTCUSDTBTC/USDT perpetual
BYBIT_SPOTSPOTBTCUSDTBitcoin to USDT (spot)
COINBASESPOTBTC-USDBitcoin to USD (spot)
DERIBITPERPETUALBTC-PERPETUAL, BTC_USDC-PERPETUALBTC/USD and BTC/USDC perpetuals
GATE_IOSPOTBTC_USDCBitcoin to USDC (spot)
GATE_IO_FUTURESPERPETUALBTC_USDTBTC/USDT perpetual
HUOBISPOTvenue-nativespot markets
HUOBI_DM_SWAP, HUOBI_DM_LINEAR_SWAPPERPETUALvenue-nativecoin- and USDT-margined swaps
HYPERLIQUIDSPOTHYPE-USDCHYPE to USDC (spot)
HYPERLIQUID_FUTURESPERPETUALBTCBTC perpetual (the bare base asset)
HYPERLIQUID_HIP3PERPETUALvenue-nativeHIP-3 perpetuals
OKEXSPOTBTC-USDTBitcoin to USDT (spot)
OKEX_FUTURESdated futuresBTC-USDT-251226BTC future (Dec 26, 2025)
OKEX_SWAPPERPETUALBTC-USDT-SWAPBTC/USDT perpetual swap
UPBITSPOTKRW-USDTKorean won to USDT
CMEdated futuresvenue-nativelisted futures; drafts and community indicators cannot read CME data, and no script may pin a CME Group market (CME, CBOT, NYMEX, COMEX, GLOBEX) as another market's input: the pin is refused by name
POLYGONUS stocks and ETFsAAPL/USD, SPY/USDa stock or ETF pinned as a reference market
FX_OTCforex, gold and silverEUR/USD, XAU/USD, XAG/USDquote candles, volume 0; served on the chart and in alerts
LBMA, LME, ICE, PLATTSretirednoneno longer served: pin gold and silver on FX_OTC (XAU/USD, XAG/USD)
POLYMARKETprediction marketsthe 66-character condition idnever written in a pin: an odds input's symbol is the condition id, and the exchange is implied

A venue with both a spot book and a derivatives book has two ids (BINANCE and BINANCE_FUTURES, BYBIT_SPOT and BYBIT, OKEX and OKEX_SWAP, GATE_IO and GATE_IO_FUTURES, HYPERLIQUID and HYPERLIQUID_FUTURES), and the same symbol can exist on both: pin the id of the book you mean.

A misspelled pin is refused

A guessed id is a pin that reads nothing, and the chart does not draw a flat line in its place: it asks for the market as written, and when nothing comes back it refuses the run and names the market it could not load, in a toast and on the overlay's Could not load chip:

text
Pinned market candle (BINANCE_FUTURES/BTCUSDTT) data is unavailable for 'Venue spreads' (the ohlcv source lane answered empty or was declined), so the indicator cannot compute.

Check the spelling against the table: the exchange id in uppercase, and the symbol the way that venue writes it.

Notes

Case sensitivity. Exchange ids are uppercase (BINANCE, never binance), and symbols are matched as the venue spells them. An interval pin takes the vocabulary's words or their short forms, and nothing else: MINUTE, FIVE_MINUTES, FIFTEEN_MINUTES, THIRTY_MINUTES, HOUR, FOUR_HOURS, DAY, WEEK, or 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, and on the chart only its custom timeframes, TWO_MINUTES to THREE_DAYS or 2m, 3m, 10m, 45m, 2h, 6h, 8h, 12h, 3d (The chart's custom timeframes).

Separators vary. Hyphens (BTC-USD), underscores (BTC_USDT), colons (BTC:USD), or nothing (BTCUSDT), per venue. The same asset is a different string on every venue, so an indicator that pins several venues carries one spelling per pin; there is no normalized symbol in a pin.

Data availability. Not every source exists for every venue and symbol: funding, open interest, and liquidations are perpetual-venue feeds, and the implied volatility and skew tenors are Deribit's. On the chart those sources always read the chart's own market. When that market does not serve one, the volume profile, implied volatility, skew, the options chain, ETF flows, and funding (unless its input declares missing: "nan" or "zero") refuse the run by name, while open interest, liquidations, and trades read their missing fill.

Dated futures and options. Use the format the venue publishes; YYMMDD in an OKX future is the expiry.

Polymarket. An odds input names one outcome market by its condition id (0x plus 64 hex characters), never the market slug or the event, with outcome YES or NO; the exchange is implicit and refused if written. The chart has no market picker, so the condition id in symbol is the only way to name the market (Data sources).

CME. Run is paused while the chart is on a CME market, and drafts and community indicators cannot read CME data; OpenMarket's official wrun indicators can.