Price Data API
Price Data API
GET https://darwintiq.com/api/price-data
Returns OHLCV price data, optionally enriched with Support/Resistance (SupRes) per bar.
Use it in two modes:
- Range mode — a list of bars from
beginonward (sortedASCorDESC). - Latest mode — only the most recent bar.
Auth required: See Authentication
Query Parameters
| Parameter | Type | Required | Allowed Values | Default | Description |
|---|---|---|---|---|---|
symbol | string | yes | EURUSD, GBPUSD, XAUUSD, USDJPY, AUDUSD, AUDNZD, GDAXI, SP500 | – | Instrument symbol (case-insensitive; DAX normalized to GDAXI, SPX500 to SP500). |
timeframe | string | no | M1 (others TBA) | M1 | Bar timeframe. |
begin | string | no | YYYY-MM-DD HH:MM:SS | – | Lower bound for range mode. Align to your first bar’s opentime for perfect sync. |
sort | string | no | ASC | DESC | ASC | Sort order for range mode. |
latest | number | no | 1 | – | If 1, returns only the most recent bar (ignores begin/sort). |
attach_supres | number | no | 1 | – | If 1, attaches the SupRes snapshot to each returned bar as supres. |
Headers
| Header | Required | Example | Notes |
|---|---|---|---|
Authorization | yes | Bearer sk_live_abc123... | Your API token (per account). |
Range mode: omit
latest(optionally providebegin).
Latest mode: setlatest=1.
Data Model
Chart Point (Bar)
type ChartPoint = {
opentime: string; // "YYYY-MM-DD HH:mm:ss"
open: number|string;
high: number|string;
low: number|string;
close: number|string;
volume?: number|string;
above?: number|string;
below?: number|string; // (if present in source)
supres?: SupResSnapshot | null; // only when attach_supres=1
};
SupRes Snapshot (optional per bar)
type SupResLevel = { idx: number; type: "R" | "S"; price: number; touches: number };
type SupResMTFLevel = SupResLevel & { tf: string };
type SupResLine = { t1: string; y1: number; t2: string; y2: number };
type SupResSnapshot = {
meta?: Record<string, unknown>;
cur?: SupResLevel[];
mtf?: SupResMTFLevel[];
reg?: { mid: SupResLine; up: SupResLine; dn: SupResLine } | null;
swing?: { top: SupResLine | null; bot: SupResLine | null } | null;
} | null;
Responses
Range Mode
{
"status": "success",
"symbol": "EURUSD",
"timeframe": "M1",
"begin": "2025-02-26 18:00:00",
"sort": "ASC",
"count": 3,
"candles": [
{
"opentime": "2025-02-26 18:00:00",
"open": 1.07810,
"high": 1.07890,
"low": 1.07795,
"close": 1.07860,
"volume": 1234.5,
"supres": null
},
{
"opentime": "2025-02-26 18:01:00",
"open": 1.07861,
"high": 1.07910,
"low": 1.07820,
"close": 1.07895,
"volume": 1130.0,
"supres": {
"cur": [ { "idx": 119, "type": "R", "price": 1.07895, "touches": 3 } ],
"mtf": [ { "tf": "M5", "idx": 23, "type": "S", "price": 1.07810, "touches": 2 } ],
"reg": {
"mid": { "t1": "2025-02-26 18:00:00", "y1": 1.0782, "t2": "2025-02-26 18:01:00", "y2": 1.0786 },
"up": { "t1": "2025-02-26 18:00:00", "y1": 1.0790, "t2": "2025-02-26 18:01:00", "y2": 1.0794 },
"dn": { "t1": "2025-02-26 18:00:00", "y1": 1.0774, "t2": "2025-02-26 18:01:00", "y2": 1.0778 }
},
"swing": {
"top": { "t1": "2025-02-26 18:00:00", "y1": 1.0792, "t2": "2025-02-26 18:01:00", "y2": 1.0796 },
"bot": { "t1": "2025-02-26 18:00:00", "y1": 1.0772, "t2": "2025-02-26 18:01:00", "y2": 1.0776 }
}
}
},
{
"opentime": "2025-02-26 18:02:00",
"open": 1.07896,
"high": 1.07930,
"low": 1.07840,
"close": 1.07910,
"volume": 1010.0,
"supres": null
}
]
}
Latest Mode
{
"status": "success",
"symbol": "EURUSD",
"timeframe": "M1",
"latest": true,
"candle": {
"opentime": "2025-02-26 18:24:00",
"open": 1.07875,
"high": 1.07905,
"low": 1.07860,
"close": 1.07898,
"volume": 980.0,
"supres": null
}
}
Examples
Range (for playback)
curl "https://darwintiq.com/api/chart-data?symbol=eurusd&timeframe=M1&begin=2025-02-26%2018:00:00&sort=ASC" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Latest only
curl "https://darwintiq.com/api/chart-data?symbol=eurusd&latest=1" \
-H "Authorization: Bearer YOUR_API_TOKEN"
With SupRes attached to each bar
curl "https://darwintiq.com/api/chart-data?symbol=eurusd&begin=2025-02-26%2018:00:00&attach_supres=1" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Status Codes
| Code | Meaning |
|---|---|
| 200 | OK |
| 400 | Missing or invalid parameters |
| 401 | Missing token |
| 403 | Invalid token / unauthorized |
| 429 | Rate limit exceeded (per user & symbol) |
| 500 | Internal error / upstream failure |
Implementation Notes
- For best playback alignment, pass
beginequal to your first bar’sopentimeand usesort=ASC. timeframeis currentlyM1; aggregated TFs may be enabled later without breaking this contract.- Timestamps are strings in
"YYYY-MM-DD HH:mm:ss"(server UTC or your DB timezone). - When plotting lines (regression/swing), ensure strictly increasing times; de-duplicate identical timestamps before rendering.
- If you proxy through your own Next.js route, forward the bearer token and consider per-user/per-symbol rate-limits as shown in the sample
route.ts.