Energy Data API

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.

27energy datasets
3energy symbols
1.29Menergy OHLC rows
2017earliest coverage

Energy symbols and coverage

The energy group contains 27 datasets for three symbols:

SymbolMarketAPI value
USOILWTI crude oil CFDUSOIL
UKOILBrent crude oil CFDUKOIL
XNGUSDUS natural gas CFDXNGUSD

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.

Rollover note: oil CFDs can gap when the underlying contract rolls. The quality report shows the gap; it does not automatically rewrite it.

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.

🚀 Invite friends — Earn $5 You both get $5 credit on Go Ad · opencode.ai AI-Powered Coding Agent — Try Free Build apps, fix bugs & ship faster with opencode. Get $5 free credit when you join. × Ad · quo.com QuoPhone — $20 Visa Gift Card Free Sign up to Quo, subscribe 3 months, get a $20 Visa gift card. Atif's referral gift for you. ×