WS
WebStriva Market
Get an API key

Public API

Connect a binary trading chart

Use this feed for a binary options chart: load candle history, then keep the live candle moving with WebSocket ticks. Base URL https://api.webstrivamarket.com/api/v1. Every REST call needs header x-api-key.

1. Create a key

Open Admin, create an API key, and store it on your chart server. Do not put the key in a public browser page if you can avoid it — proxy the calls from your backend, or use a short-lived stream session (step 4).

2. Symbols for binary pairs

Send the feed symbol, not a display name. Gold on the binary chart is XAUUSD.

Chart labelAPI symbol
GoldXAUUSD
BitcoinBTCUSD or BTCUSDT
EUR/USDEURUSD
Full listGET /markets/symbols

3. Load candles (history)

Resolutions: 1m, 5m, 15m, 1h, 1d. Limit 1–5000. For older pages, pass before as the meta.oldest ISO time while meta.hasMore is true.

curl -s "https://api.webstrivamarket.com/api/v1/markets/history?symbol=XAUUSD&resolution=1m&limit=300" \
  -H "x-api-key: YOUR_API_KEY"
{
  "data": [
    {
      "symbol": "XAUUSD",
      "resolution": "1m",
      "open": 4126.1,
      "high": 4127.4,
      "low": 4125.8,
      "close": 4127.2,
      "volume": 0,
      "timestamp": "2026-10-20T22:07:00.000Z"
    }
  ],
  "meta": { "count": 300, "hasMore": true, "oldest": "2026-10-20T17:07:00.000Z" }
}

4. Live price (snapshot)

Use this to paint the current price and to correct the open candle if the socket reconnects. Up to 100 symbols, comma-separated.

curl -s "https://api.webstrivamarket.com/api/v1/markets/live?symbols=XAUUSD,EURUSD" \
  -H "x-api-key: YOUR_API_KEY"
{
  "data": [
    {
      "symbol": "XAUUSD",
      "price": 4127.29,
      "assetClass": "commodity",
      "source": "gold-api",
      "timestamp": 1792534118673
    }
  ],
  "meta": { "found": 1, "notFound": [] }
}

5. Live ticks (WebSocket)

Preferred for a smooth chart. Create a session with your key (the session lasts 1 hour and does not expose the key on the socket), then connect. Max 20 symbols per socket.

POST https://api.webstrivamarket.com/api/v1/markets/stream-session
x-api-key: YOUR_API_KEY
Content-Type: application/json

{ "symbols": ["XAUUSD"] }

→ { "data": { "sessionId": "…", "wsUrl": "wss://api.webstrivamarket.com/api/v1/markets/stream" } }
const ws = new WebSocket(
  data.wsUrl + "?session=" + data.sessionId + "&symbols=XAUUSD"
);

ws.onmessage = (ev) => {
  const msg = JSON.parse(ev.data);
  if (msg.type === "connected") return;          // { symbols, timestamp }
  if (msg.type === "tick") applyTick(msg.data);  // { symbol, price, timestamp }
  if (msg.type === "bar") applyBar(msg.data);    // closed OHLC candle
};

// Change symbols without reconnecting:
ws.send(JSON.stringify({ type: "subscribe", symbols: ["EURUSD"] }));

Server-side only, you can skip the session and connect with the key in the query: wss://api.webstrivamarket.com/api/v1/markets/stream?symbols=XAUUSD&apiKey=YOUR_API_KEY

6. Smooth binary candles

History is 1-minute bars. A 5-second binary chart should keep those bars as history, then build the live candle from ticks. Update the last candle in place — do not redraw the whole series on every tick.

const BUCKET_MS = 5000;
let candles = history.map(barToCandle); // time = Date.parse(bar.timestamp)

function applyTick(tick) {
  const t = Math.floor(tick.timestamp / BUCKET_MS) * BUCKET_MS;
  const last = candles[candles.length - 1];
  if (!last || last.time !== t) {
    candles.push({ time: t, open: tick.price, high: tick.price, low: tick.price, close: tick.price });
  } else {
    last.close = tick.price;
    last.high = Math.max(last.high, tick.price);
    last.low = Math.min(last.low, tick.price);
  }
  chart.update(candles[candles.length - 1]); // update last bar only
}

// On reconnect: GET /markets/live and set the open candle close to that price.
// Renew the stream session before the 1 hour TTL.

Checklist