Skip to main content
This guide takes you from an API key to live candles in three requests.

Before you start

  • An API key. See Authentication.
  • curl for REST requests and any WebSocket client that can send headers, for example websocat.
Keep the key in an environment variable so it does not end up in your shell history or code:

1. Find a security

Every data request needs an exchange and a symbol. Look them up with search:
Each hit contains an exchange and symbol pair you can pass to the other endpoints. Always take the pair from here: exchange codes are TakeProfit’s own, not the MIC of the listing venue, so Apple comes back as exchange=BATS, not XNAS. The same symbol usually trades on several exchanges, so pick the one you want:

2. Load historical candles

Ask for hourly candles from a given timestamp. The range is optional — without it you get the most recent 1000 candles — so from, to, period and limit are there to narrow the window. Note that period counts seconds (86400), it is not a timeframe id:
Prices and volumes come as decimal strings, so no precision is lost:
Trailing zeros are trimmed, so a price can come back as 78562 rather than 78562.00. Parse the strings with a decimal type, never a float. Valid timeframe ids come from GET /api/v1/marketdata/timeframes.

3. Subscribe to live candles

Open a WebSocket connection with the subscription parameters in the query string and the key in the handshake header:
The server first sends the latest candle, then an update every time the forming candle changes. You send nothing after the handshake:
The first frame carries "isLast": true — it closes the history the stream starts from. Every later frame for the forming candle arrives with "isLast": false and the same timestamp, so update the candle in place instead of appending it.

Errors

A REST error, or a rejected WebSocket handshake, comes back as an HTTP status with a JSON body:
Every error uses that shape, and code is stable enough to branch on: invalid_argument for a bad or unknown parameter, unauthenticated for a missing or rejected key, not_found for an exchange or symbol that is not served.

Next steps

  • Browse the endpoints in the REST API and WebSocket API groups of this tab.
  • Read the Overview for what each group returns and how credits are charged.