Documentation

API reference

Everything is authenticated with an API key. A key is tied to a list of symbols and, optionally, the website domains allowed to use it.

# your first request
curl -H "x-api-key: YOUR_API_KEY" \
  https://marketdatafeed.net/v1/quote/XAUUSD

The same two calls — recent candles and a live price stream — in the language you use:

# last 100 hourly candles as CSV
curl -H "x-api-key: YOUR_API_KEY" \
  "https://marketdatafeed.net/v1/candles/XAUUSD?timeframe=H1&limit=100&format=csv"

# live prices (needs websocat)
echo '{"op":"subscribe","symbols":["XAUUSD"]}' | \
  websocat "wss://marketdatafeed.net/v1/stream?key=YOUR_API_KEY"

Authentication

Send the key as the x-api-key header, or as ?key= in the URL. The WebSocket requires the query form.

x-api-keyHeader form. Recommended for server-to-server calls.
?key=Query form. Needed for WebSocket and for the widget.
DomainsBrowser calls must come from a domain on the key's allow-list. Calls without an Origin header are allowed.

Chart widget

Load the script once, then add a data-it-chart element wherever you want a chart.

<script src="https://marketdatafeed.net/widget.js"></script>

<div data-it-chart
     data-key="YOUR_API_KEY"
     data-symbol="XAUUSD"
     data-timeframe="H1"
     data-theme="dark"
     style="height:520px"></div>
data-keyRequired. Your API key.
data-symbolInitial symbol. Default XAUUSD.
data-timeframeM1 M3 M5 M15 M30 H1 H2 H4 D1 W1 MN. Default H1.
data-themedark or light. Default dark.
data-symbolsComma list that limits the symbol picker.
data-toolbarfalse hides the toolbar.
data-toolsfalse hides the Indicators and Draw menus, keeping the symbol search and timeframes.
data-volumefalse hides the volume pane.

The toolbar has a searchable symbol picker, nine timeframes, an Indicators menu with 79 studies (12 with editable settings such as moving averages, RSI, Bollinger Bands, MACD and Stochastic, plus 67 technical indicators), and a Draw menu with 85 tools in 15 groups (lines, channels, pitchforks, Fibonacci, Gann, chart patterns, Elliott waves, forecasting, volume, measuring, shapes and notes). It also has undo and redo, snapping to candle highs and lows, chart type (candles, Heikin Ashi, line, bars), theme, PNG export and fullscreen. Indicators and drawings are remembered per browser.

Click a drawing or right-click it to change its colour, width, dash, fill, text and Fibonacci levels, clone it, reorder it, lock it or hide it. Objects lists everything on the chart with show / hide / lock / delete and bulk Hide all / Lock all. Indicator colours, line widths and visibility are editable (⚙ next to each study), and ★ pins favourite indicators and tools. The range bar (1D to 5Y) loads history as needed, a countdown shows time to the bar close, and ⚙ in the toolbar sets candle and background colours, grid, watermark, price line and crosshair style. Shortcuts: Ctrl+C / V copy and paste a drawing, Ctrl+D clone, Del delete, Esc cancel, Alt+T / H / V / F / R trend, horizontal and vertical line, Fibonacci, rectangle.

Alerts (🔔) fire when the live bid crosses a price you set: right-click the chart or type a price. A toast and a short beep show in the page, the widget emits an indiantrader:alert DOM event, and you can pass an onAlert callback. Alerts live in the visitor's browser and only fire while the page is open. Replay (bottom bar) plays history bar by bar with play, step, a scrubber and 1× to 30× speed. Layouts (⚙) save and restore indicators, drawings, colours, symbol and timeframe under a name, with JSON export and import.

Multi-chart: <div data-it-multi data-key="…" data-layout="4" data-sync="true" data-symbols="XAUUSD,EURUSD,BTCUSD,GBPUSD" style="height:600px"></div> (or IndianTrader.multi(el, opts)) shows one to four charts in a grid with a layout picker. Layouts are 1, 2, 2v, 3 and 4; data-sync keeps the timeframe the same on every chart. All charts on a page share one stream connection, so a grid costs a single connection slot. Try it.

JavaScript API

const chart = IndianTrader.chart('#my-div', { key: 'YOUR_API_KEY', symbol: 'EURUSD' });
chart.setSymbol('GBPUSD');
chart.setTimeframe('H4');
chart.destroy();

Pass onChange: ({ symbol, timeframe, theme }) => … to be told when the visitor changes the chart.

REST API

Base URL: https://marketdatafeed.net. All responses are JSON. Errors return {"error": "…"} with a matching status code.

GET/v1/symbols

The symbols your key can use, with price digits and the last quote.

{ "data": [ { "symbol": "XAUUSD", "digits": 2,
            "bid": 3876.9, "ask": 3877.06, "time": 1793393700054 } ] }

GET/v1/quote/:symbol

The latest quote for one symbol.

GET/v1/overview

A snapshot for a watchlist or heatmap in one call: quote, change versus the previous daily close, today's range, and a day of sparkline closes. Up to 60 symbols.

symbolsOptional comma list. Defaults to every symbol your key can use (first 60).
{ "data": [ { "symbol": "XAUUSD", "digits": 2, "bid": 3876.9, "ask": 3877.06,
            "prevClose": 4010.2, "change": -3.313,
            "high": 4018.865, "low": 3870.285,
            "spark": [ 3890.1, 3888.4, … ] } ] }

change, high, low and spark are empty for symbols without candle history.

GET/v1/usage

Your key's limits and the last 14 days of use: REST calls, stream messages and connections per day. It works from any domain, and you can also see it, with charts, by signing in at app.marketdatafeed.net.

GET/v1/candles/:symbol

timeframeM1 M2 M3 M5 M10 M15 M30 H1 H2 H3 H4 H6 H8 H12 D1 W1 MN. Default H1.
limit1 to 1500. Default 500.
toUnix milliseconds. Returns the candles ending at this time — use it to page backwards.
formatjson (default) or csv — a file with time, datetime, open, high, low, close, volume columns that opens straight in Excel or Sheets.
{ "symbol": "XAUUSD", "timeframe": "H1", "count": 200,
  "data": [ { "time": 1792389600, "open": 4184.7, "high": 4186.6,
            "low": 4171.2, "close": 4183.9, "volume": 8675 } ] }

Times are Unix seconds, oldest first. Daily bars follow the broker's midnight, so they may not start at 00:00 UTC. Weekly and monthly bars are built from daily bars, and M2, M3, M10, H2, H3, H6, H8 and H12 from finer stored bars.

WebSocket stream

Connect to wss://marketdatafeed.net/v1/stream?key=YOUR_API_KEY, then subscribe to symbols.

→ send
{"op":"subscribe","symbols":["XAUUSD","EURUSD"]}
{"op":"unsubscribe","symbols":["EURUSD"]}
{"op":"ping"}

← receive
{"t":"hello","symbols":251}
{"t":"ticks","d":[["XAUUSD",3876.9,3877.06,1793393700054]]}
{"t":"candle","s":"XAUUSD","tf":"M1","c":[1793393640,3876.5,3877.1,3876.4,3876.9,241]}
{"t":"error","error":"unknown symbol ABC"}
ticks[symbol, bid, ask, time in ms]. Batched, with the newest tick per symbol, about ten times a second.
candleA closed bar: [time, open, high, low, close, volume].
reconnectReconnect with backoff after a drop and re-send your subscriptions.

Errors and limits

401Invalid API key.
403Key disabled or expired, or the domain isn't allowed for this key.
404Unknown symbol, or one outside the key's scope.
429Rate limit reached, or too many connections for this key. Wait for Retry-After seconds.
502History is temporarily unavailable. Retry shortly.

Every REST response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds until the one-minute window resets), so a client can slow down before it is limited. Browser code can read them too. Live service health is on the status page.