Free Energy Historical Data API
Access WTI, Brent and natural gas OHLC history for commodity backtests, volatility research and macro-style models.
Updated 2026-11-02 ? Data refreshed from the AlgoSpecial catalog.
Energy symbols and coverage
The energy group contains 27 datasets for three symbols:
| Symbol | Market | API value |
|---|---|---|
| USOIL | WTI crude oil CFD | USOIL |
| UKOIL | Brent crude oil CFD | UKOIL |
| XNGUSD | US natural gas CFD | XNGUSD |
Energy datasets support M1, M5, M15, M30, H1, H4, D1, W1 and MN1. WTI and Brent histories start earlier than natural gas in this catalog; check the dataset coverage before building a multi-year study.
Energy OHLC request
Request energy bars with the same OHLC endpoint. The example below pulls USOIL H1. These are broker CFD prices, so contract rollover and session gaps can appear in the history.
Energy data quality
Energy datasets are checked for duplicates, OHLC violations, invalid prices, flat bars, gaps, extreme returns, volume and spread anomalies. Use the quality report to identify rollover dates and thin-liquidity periods before training a model.
Energy API use cases
Commodity backtests
Test trend, breakout and mean-reversion rules on WTI or Brent.
Volatility research
Compare crude and natural gas volatility across sessions and seasons.
Macro features
Use energy returns as inputs for cross-asset models.
Energy API limits
The free tier is limited to 60 requests per minute, 1,000 requests per day, 50,000 rows and 366 days per request. Split long M1 histories into yearly windows.
Request examples
cURL - WTI H1 JSON
curl "https://www.algospecial.com/api/ohlc.php?symbol=USOIL&tf=H1&from=2026-01-01&to=2026-03-31&format=json"
Python - Brent daily bars
import pandas as pd
import requests
params = {
"symbol": "UKOIL",
"tf": "D1",
"from": "2024-01-01",
"to": "2025-12-31",
}
r = requests.get("https://www.algospecial.com/api/ohlc.php", params=params, timeout=30)
r.raise_for_status()
df = pd.DataFrame(r.json()["data"])
df["Timestamp"] = pd.to_datetime(df["Timestamp"])
print(df.tail())
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.
Energy API FAQ
Which energy markets are available?
USOIL for WTI crude, UKOIL for Brent crude and XNGUSD for US natural gas.
Why does natural gas history start later?
Coverage depends on the source export. Check the dataset catalog or quality report for the exact start date.
Are these futures or CFD prices?
They are broker CFD quotes. Contract rollover can create gaps that are visible in the quality report.
Can I get energy data as CSV?
Yes. Add format=csv to the OHLC request.
Is the energy API free?
Yes, with the same public rate limits as the other datasets.
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.