Skip to main content
GET

Request

string
required
Trading symbol (e.g., EURUSD, GBPUSD, XAUUSD)
integer
required
Timeframe in minutes:
  • 1 - M1 (1 minute)
  • 5 - M5 (5 minutes)
  • 15 - M15 (15 minutes)
  • 60 - H1 (1 hour)
  • 240 - H4 (4 hours)
  • 1440 - D1 (1 day)
integer
default:"500"
Number of bars to return. Maximum: 5000
integer
Unix timestamp (UTC seconds). Only bars with time < before_time are returned (strict: a bar whose time equals the cursor is excluded). Must be a positive integer and not in the future, otherwise the API answers 422. Omit it to get the latest bars (unchanged behavior). Page backwards by sending pagination.next_before_time of the previous response.With before_time the last (still forming) bar is never returned; without it the latest bar may still be forming, as before.

Response

boolean
Indicates if the request was successful
string
The requested symbol
integer
The requested timeframe in minutes
integer
Number of bars returned
array
Array of OHLC bar objects
object
Pagination information

Pagination Example

To fetch more historical data:

Availability and limits of history mode

History mode (before_time) is gated by the server flag EXTERNAL_BARS_HISTORY_ENABLED (default off). While it is off, before_time is accepted and ignored and pagination.history_enabled is false (next_before_time is not sent): do not loop on has_more in that case. When on, pagination.history_enabled is true. Requests with before_time are limited per token (default 60 pages per hour; 429 with a Retry-After header) and to 2 concurrent requests per token (429); a slow upstream answers 504, and a failed upstream request answers 503 (upstream_error): this is NOT the end of history, retry the same before_time. Only an empty 200 page means there is no older history. Requests without before_time are not affected by these limits.

How far back can you go

has_more is true when the page came back full, so the last page of a series can be empty (count: 0, has_more: false, HTTP 200). Beyond the history ceiling below the server also answers an empty page. Without before_time an empty result keeps answering 503 no_data. The ceiling depends on the timeframe (estimated by calculation, not measured): bar_number is the index inside each response (0 = oldest of that page), not a global index: use time as the key when stitching pages together.
The time field is the real Unix timestamp from the market data source. Always use this value when submitting signals to ensure correct positioning on the chart.