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"
// Node 18+ or any browser const KEY = 'YOUR_API_KEY'; const res = await fetch('https://marketdatafeed.net/v1/candles/XAUUSD?timeframe=H1&limit=100', { headers: { 'x-api-key': KEY } }); const { data } = await res.json(); console.log(data.at(-1)); // { time, open, high, low, close, volume } const ws = new WebSocket(`wss://marketdatafeed.net/v1/stream?key=${KEY}`); ws.onopen = () => ws.send(JSON.stringify({ op: 'subscribe', symbols: ['XAUUSD'] })); ws.onmessage = (e) => { const m = JSON.parse(e.data); if (m.t === 'ticks') for (const [symbol, bid, ask] of m.d) console.log(symbol, bid, ask); };
# pip install requests websockets import asyncio, json, requests, websockets KEY = "YOUR_API_KEY" r = requests.get("https://marketdatafeed.net/v1/candles/XAUUSD", params={"timeframe": "H1", "limit": 100}, headers={"x-api-key": KEY}) print(r.json()["data"][-1]) async def stream(): async with websockets.connect(f"wss://marketdatafeed.net/v1/stream?key={KEY}") as ws: await ws.send(json.dumps({"op": "subscribe", "symbols": ["XAUUSD"]})) async for raw in ws: m = json.loads(raw) if m["t"] == "ticks": for symbol, bid, ask, ts in m["d"]: print(symbol, bid, ask) asyncio.run(stream())
Authentication
Send the key as the x-api-key header, or as ?key= in the URL. The WebSocket requires the query form.
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>
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.
{ "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
json (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"}
Errors and limits
Retry-After seconds.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.