Home/User Guides/Scripting

Can my scripts read index and yield markets?

Yes, in a browser run on the web app. A script pins the market with exchange "INDICES_OTC" and reads its price candles. Cloud runs, Protected scripts, alerts and the phone app do not read the pin.

Yes, in a browser run. A wrun indicator can pin one of the 22 index and yield markets, such as US500, DXY or US10Y, on any chart. Name the exchange INDICES_OTC on the input:

Code
input('dxy', ohlcv.close, { symbol: 'DXY', exchange: 'INDICES_OTC' });

A symbol setting can name one too, for example INDICES_OTC:US500.

What the pin reads

  • Price candles only. Open, high, low and close. Volume reads 0.
  • A trades, order book, open interest, funding or liquidations pin on these markets is not read. The chart says the index and yield markets serve price candles only.

Where it reads, and where it does not

  • Reads: a browser run on the web app. Choose Browser under Run on.
  • Cloud runs do not read it. With Cloud under Run on, the pin is refused with this message: "Index and yield markets can be pinned in browser runs only. Server runs, Protected scripts and alerts cannot read them."
  • Protected scripts do not read it. A Protected script runs on OpenMarket's servers, so the same message shows.
  • Alerts do not read it. The chart refuses an alert on a script that pins an index or yield market: "This Indicator reads a market alerts cannot evaluate yet (an index)."
  • The phone app does not read it. The row stays empty, and the app says index prices like US500 are not open to indicators yet.

On a chart of an index or yield market itself, a browser run reads the chart's own candles like on any chart.