CSV and JSON OHLC API Formats
Choose JSON for applications and pandas, or CSV for Excel, MT5 and quick inspection. Both return the same OHLC bars and the same broker-server timestamps.
Updated 2026-11-02 ? Data refreshed from the AlgoSpecial catalog.
JSON response shape
JSON is the default. The top-level object contains request metadata and a data array. Each array item is one OHLC bar.
| Key | Type | Description |
|---|---|---|
symbol | string | Display symbol, such as XAUUSD |
timeframe | string | M1, M5, M15, M30, H1, H4, D1, W1 or MN1 |
from, to | string | Requested date range |
rows | integer | Number of bars in data |
data | array | Bar objects with Timestamp, Open, High, Low, Close, TickVolume and Spread |
CSV response
Add format=csv to receive a header row followed by one row per bar. The CSV header is:
Timestamp,Open,High,Low,Close,TickVolume,Spread
The timestamp uses YYYY.MM.DD HH:MM:SS in broker server time. Prices are numeric. TickVolume and Spread are integers and may be 0 on legacy forex feeds.
Which format should you use?
JSON
Best for Python, JavaScript, APIs and applications that need named fields.
CSV
Best for Excel, MT5 import, SQL bulk loading and quick visual inspection.
Parquet
Not returned by the HTTP API. Use the builder for Parquet downloads.
Format notes and limitations
- JSON and CSV contain the same rows; the format does not change the data.
- Timestamps are broker server time, not UTC.
- Some legacy datasets have no tick volume or spread; those fields return 0.
- The HTTP API does not return Parquet. Parquet is available through the download builder.
- A response is capped at 50,000 rows and a 366-day range.
Request examples
JSON request
curl "https://www.algospecial.com/api/ohlc.php?symbol=XAUUSD&tf=M15&from=2026-01-01&to=2026-01-31&format=json"
CSV request
curl "https://www.algospecial.com/api/ohlc.php?symbol=XAUUSD&tf=M15&from=2026-01-01&to=2026-01-31&format=csv" -o XAUUSD_M15.csv
Read CSV with pandas
import pandas as pd
url = "https://www.algospecial.com/api/ohlc.php"
params = {
"symbol": "XAUUSD",
"tf": "M15",
"from": "2026-01-01",
"to": "2026-01-31",
"format": "csv",
}
df = pd.read_csv(url, params=params)
df["Timestamp"] = pd.to_datetime(df["Timestamp"])
print(df.head())
All timestamps are broker server time. Some legacy forex exports return 0 for TickVolume and Spread because those fields were not present in the source feed.
CSV & JSON FAQ
What is the default response format?
JSON. Add format=csv for CSV.
Do JSON and CSV contain the same data?
Yes. The format changes only the representation, not the OHLC rows.
What timestamp format is used?
YYYY.MM.DD HH:MM:SS in broker server time.
Can the API return Parquet?
No. Parquet is available through the historical data builder, not the HTTP API.
Why are TickVolume and Spread zero?
Some legacy source feeds do not include volume or spread history. The API returns 0 instead of inventing values.
Choose the next useful step
Most visitors arrive with one question: build, test, price, or trust. These shortcuts keep the path practical.
Go deeper before you build, download or automate
Hand-picked engineering articles, indicator breakdowns and trading-system tools so visitors keep exploring instead of leaving after one page.
Pine Script to MT4/MT5 Conversion Planner
Analyze Pine strategies, repainting risk, TradingView alert bridges, MTF synchronization and the correct MQL4/MQL5 build path before paying for conversion.
Open planner
3-in-1 MT5 Indicator Bundle
12H Bias Engine, Smart Money Institutional Flow Dashboard and D1/H1 pending-signal logic with MQ5 + EX5 source included via Etsy.
MT5 Bank Orders Institutional Flow Dashboard
Supply/demand zones, BOS/CHoCH, liquidity levels, FVG, equal highs/lows and confirmed trade-plan logic explained with EX5 download.
MT5 Asia London NY Liquidity Engine
Asia range, London raid and New York continuation/reversal planning with internal session backtest stats and entry/SL/TP dashboard.
Interactive Brokers RSI Pair Trader
Tkinter desktop trading workflow, TWS API connection handling, RSI pair logic, risk controls and custom IBKR development positioning.
XAUUSD M30 CSV Data For Backtesting
Use clean MT5 historical data for Python backtests, strategy validation, spread checks and realistic gold EA research workflows.