OilPriceAPI Documentation
GitHub
GitHub
  • Interactive Explorer

    • Interactive API Explorer
  • Price Data

    • API Reference
    • Get Latest Prices
    • Historical Prices
  • Commodities

    • List Commodities
    • Get Commodity Details
  • Marine Fuels

    • List Marine Fuel Ports
    • Get Port Details with Prices
  • Premium Endpoints

    • All Prices API - One Call, All Commodities
    • Cushing Oil Storage Intelligence API
    • Drilling Intelligence API
    • Marine Fuels API
    • ICE Brent Futures API

ICE Brent Futures API

Overview

Real-time and historical Brent crude oil futures data from the Intercontinental Exchange (ICE). Essential for traders, risk managers, and market analysts.

Endpoints

EndpointDescriptionUpdate Frequency
/v1/futures/ice-brentCurrent futures prices5 minutes
/v1/futures/ice-brent/historicalHistorical price dataDaily
/v1/futures/ice-brent/ohlcDaily OHLC summariesEnd of day
/v1/futures/ice-brent/intraday5-minute intervalsReal-time
/v1/futures/ice-brent/spreadsCalendar spreads5 minutes
/v1/futures/ice-brent/curveFutures curve analysis5 minutes
/v1/futures/ice-brent/spread-historyHistorical spreadsDaily

Authentication

All futures endpoints require authentication:

curl -X GET "https://api.oilpriceapi.com/v1/futures/ice-brent" \
  -H "Authorization: Token YOUR_API_KEY"

Current Futures Prices

Get the latest prices for all active Brent futures contracts:

curl -X GET "https://api.oilpriceapi.com/v1/futures/ice-brent" \
  -H "Authorization: Token YOUR_API_KEY"

Response:

{
  "commodity": "BRENT_FUTURES",
  "source": "ICE",
  "updated_at": "2025-09-20T14:30:00.000Z",
  "trading_hours": "01:00-23:00 GMT",
  "contracts": [
    {
      "contract_month": "2025-11",
      "last_price": 85.42,
      "currency": "USD",
      "open": 84.95,
      "close": 85.35,
      "high": 85.75,
      "low": 84.80,
      "volume": 125432,
      "change_percent": 0.47,
      "updated_at": "2025-09-20T14:30:00.000Z"
    },
    {
      "contract_month": "2025-12",
      "last_price": 85.15,
      "currency": "USD",
      "open": 84.70,
      "close": 85.10,
      "high": 85.50,
      "low": 84.55,
      "volume": 98765,
      "change_percent": 0.41,
      "updated_at": "2025-09-20T14:30:00.000Z"
    }
  ],
  "metadata": {
    "total_contracts": 12,
    "data_source": "ice",
    "persistence": "database",
    "retention_period": "30_days"
  }
}

Historical Data

Retrieve historical futures prices with flexible date ranges:

curl -X GET "https://api.oilpriceapi.com/v1/futures/ice-brent/historical?from=2025-09-01&to=2025-09-20&contracts=2025-11,2025-12" \
  -H "Authorization: Token YOUR_API_KEY"

Parameters

ParameterTypeDescriptionExample
fromdateStart date (ISO 8601)2025-09-01
todateEnd date (ISO 8601)2025-09-20
contractsstringSpecific contracts (comma-separated)2025-11,2025-12
formatstringResponse formatjson or csv

Response:

{
  "period": {
    "from": "2025-09-01",
    "to": "2025-09-20"
  },
  "data": [
    {
      "date": "2025-09-01",
      "contract": "2025-11",
      "open": 83.50,
      "high": 84.20,
      "low": 83.30,
      "close": 84.10,
      "volume": 112345,
      "settlement": 84.08
    }
  ]
}

OHLC Daily Summaries

Get daily Open, High, Low, Close data for technical analysis:

curl -X GET "https://api.oilpriceapi.com/v1/futures/ice-brent/ohlc?days=30&contract=2025-11" \
  -H "Authorization: Token YOUR_API_KEY"

Response:

{
  "contract": "2025-11",
  "period_days": 30,
  "ohlc_data": [
    {
      "date": "2025-09-20",
      "open": 84.95,
      "high": 85.75,
      "low": 84.80,
      "close": 85.42,
      "volume": 125432,
      "vwap": 85.28,
      "trades": 8934
    }
  ],
  "statistics": {
    "average_close": 84.87,
    "volatility": 2.34,
    "total_volume": 3456789,
    "highest": 86.20,
    "lowest": 82.15
  }
}

Intraday Data (5-Minute Intervals)

High-frequency data for active traders:

curl -X GET "https://api.oilpriceapi.com/v1/futures/ice-brent/intraday?date=2025-09-20&contract=2025-11" \
  -H "Authorization: Token YOUR_API_KEY"

Response:

{
  "contract": "2025-11",
  "date": "2025-09-20",
  "intervals": [
    {
      "time": "2025-09-20T09:00:00Z",
      "open": 84.95,
      "high": 85.02,
      "low": 84.93,
      "close": 85.00,
      "volume": 543
    },
    {
      "time": "2025-09-20T09:05:00Z",
      "open": 85.00,
      "high": 85.05,
      "low": 84.98,
      "close": 85.03,
      "volume": 412
    }
  ]
}

Calendar Spreads

Analyze price relationships between contract months:

curl -X GET "https://api.oilpriceapi.com/v1/futures/ice-brent/spreads?pairs=2025-11,2025-12;2025-12,2026-01" \
  -H "Authorization: Token YOUR_API_KEY"

Response:

{
  "spreads": [
    {
      "front_month": "2025-11",
      "back_month": "2025-12",
      "front_price": 85.42,
      "back_price": 85.15,
      "spread": 0.27,
      "spread_type": "backwardation",
      "percentage": 0.32
    },
    {
      "front_month": "2025-12",
      "back_month": "2026-01",
      "front_price": 85.15,
      "back_price": 84.90,
      "spread": 0.25,
      "spread_type": "backwardation",
      "percentage": 0.29
    }
  ],
  "analysis": {
    "market_structure": "backwardation",
    "average_spread": 0.26,
    "trend": "narrowing"
  }
}

Futures Curve Analysis

Comprehensive analysis of the entire futures curve:

curl -X GET "https://api.oilpriceapi.com/v1/futures/ice-brent/curve?date=2025-09-20" \
  -H "Authorization: Token YOUR_API_KEY"

Response:

{
  "date": "2025-09-20",
  "curve": [
    {"contract": "2025-11", "price": 85.42, "days_to_expiry": 41},
    {"contract": "2025-12", "price": 85.15, "days_to_expiry": 71},
    {"contract": "2026-01", "price": 84.90, "days_to_expiry": 102},
    {"contract": "2026-02", "price": 84.65, "days_to_expiry": 133}
  ],
  "analysis": {
    "structure": "backwardation",
    "front_month_premium": 0.27,
    "average_monthly_roll": -0.25,
    "steepness": "moderate",
    "carry_trade_signal": "negative"
  },
  "metrics": {
    "1_month_spread": -0.27,
    "3_month_spread": -0.77,
    "6_month_spread": -1.85,
    "12_month_spread": -3.42
  }
}

Implementation Examples

JavaScript - Futures Curve Visualization

class FuturesCurveAnalyzer {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseUrl = 'https://api.oilpriceapi.com/v1/futures/ice-brent';
  }

  async analyzeCurve() {
    const response = await fetch(`${this.baseUrl}/curve`, {
      headers: { 'Authorization': `Token ${this.apiKey}` }
    });

    const data = await response.json();
    return this.calculateMetrics(data);
  }

  calculateMetrics(data) {
    const curve = data.curve;
    const frontMonth = curve[0];
    const backMonth = curve[curve.length - 1];

    return {
      structure: data.analysis.structure,
      totalCurveSpread: frontMonth.price - backMonth.price,
      annualizedCarry: this.calculateAnnualizedCarry(curve),
      tradingSignal: this.generateSignal(data.analysis),
      chartData: this.formatForChart(curve)
    };
  }

  calculateAnnualizedCarry(curve) {
    if (curve.length < 2) return 0;

    const monthlyRoll = (curve[0].price - curve[1].price);
    return monthlyRoll * 12;
  }

  generateSignal(analysis) {
    if (analysis.structure === 'backwardation' &&
        Math.abs(analysis.front_month_premium) > 0.5) {
      return 'STRONG_SELL_CARRY';
    } else if (analysis.structure === 'contango' &&
               analysis.front_month_premium < -0.5) {
      return 'STRONG_BUY_CARRY';
    }
    return 'NEUTRAL';
  }

  formatForChart(curve) {
    return curve.map(point => ({
      x: point.contract,
      y: point.price,
      daysToExpiry: point.days_to_expiry
    }));
  }
}

// Usage
const analyzer = new FuturesCurveAnalyzer('YOUR_API_KEY');
const analysis = await analyzer.analyzeCurve();
console.log(`Market Structure: ${analysis.structure}`);
console.log(`Trading Signal: ${analysis.tradingSignal}`);

Python - Spread Trading Strategy

import requests
from datetime import datetime, timedelta
import numpy as np

class SpreadTradingStrategy:
    def __init__(self, api_key):
        self.api_key = api_key
        self.base_url = 'https://api.oilpriceapi.com/v1/futures/ice-brent'

    def analyze_calendar_spread(self, front_contract, back_contract, days=30):
        """Analyze historical spread behavior"""

        # Get spread history
        response = requests.get(
            f'{self.base_url}/spread-history',
            params={
                'front_contract': front_contract,
                'back_contract': back_contract,
                'days': days
            },
            headers={'Authorization': f'Token {self.api_key}'}
        )

        data = response.json()
        spreads = [d['spread'] for d in data['history']]

        return {
            'current_spread': spreads[-1],
            'mean_spread': np.mean(spreads),
            'std_spread': np.std(spreads),
            'z_score': (spreads[-1] - np.mean(spreads)) / np.std(spreads),
            'percentile': self.calculate_percentile(spreads[-1], spreads),
            'signal': self.generate_signal(spreads)
        }

    def calculate_percentile(self, current, historical):
        """Calculate current spread percentile"""
        return (sum(1 for x in historical if x <= current) / len(historical)) * 100

    def generate_signal(self, spreads):
        """Generate trading signal based on spread analysis"""
        current = spreads[-1]
        mean = np.mean(spreads)
        std = np.std(spreads)
        z_score = (current - mean) / std

        if z_score > 2:
            return {'action': 'SELL_SPREAD', 'confidence': 'HIGH'}
        elif z_score > 1:
            return {'action': 'SELL_SPREAD', 'confidence': 'MEDIUM'}
        elif z_score < -2:
            return {'action': 'BUY_SPREAD', 'confidence': 'HIGH'}
        elif z_score < -1:
            return {'action': 'BUY_SPREAD', 'confidence': 'MEDIUM'}
        else:
            return {'action': 'HOLD', 'confidence': 'NEUTRAL'}

    def calculate_roll_yield(self):
        """Calculate implied roll yield from futures curve"""
        response = requests.get(
            f'{self.base_url}/curve',
            headers={'Authorization': f'Token {self.api_key}'}
        )

        data = response.json()
        curve = data['curve']

        roll_yields = []
        for i in range(len(curve) - 1):
            days_diff = curve[i+1]['days_to_expiry'] - curve[i]['days_to_expiry']
            price_diff = curve[i]['price'] - curve[i+1]['price']
            annualized_yield = (price_diff / curve[i]['price']) * (365 / days_diff)
            roll_yields.append({
                'from': curve[i]['contract'],
                'to': curve[i+1]['contract'],
                'yield': annualized_yield * 100  # Convert to percentage
            })

        return roll_yields

# Usage
strategy = SpreadTradingStrategy('YOUR_API_KEY')

# Analyze specific spread
spread_analysis = strategy.analyze_calendar_spread('2025-11', '2025-12')
print(f"Current Z-Score: {spread_analysis['z_score']:.2f}")
print(f"Signal: {spread_analysis['signal']}")

# Calculate roll yields
roll_yields = strategy.calculate_roll_yield()
for roll in roll_yields:
    print(f"{roll['from']} → {roll['to']}: {roll['yield']:.2f}% annualized")

Ruby - Market Structure Monitor

require 'net/http'
require 'json'
require 'time'

class MarketStructureMonitor
  def initialize(api_key)
    @api_key = api_key
    @base_url = 'https://api.oilpriceapi.com/v1/futures/ice-brent'
  end

  def monitor_structure_changes
    current = get_current_structure
    historical = get_historical_structures(days: 30)

    {
      current_structure: current[:structure],
      days_in_current: count_consecutive_days(historical, current[:structure]),
      structure_changes: detect_changes(historical),
      strength: calculate_structure_strength(current),
      alerts: generate_alerts(current, historical)
    }
  end

  private

  def get_current_structure
    uri = URI("#{@base_url}/curve")
    request = make_request(uri)
    response = execute_request(uri, request)
    JSON.parse(response.body, symbolize_names: true)[:analysis]
  end

  def get_historical_structures(days:)
    # Get historical curve data for trend analysis
    end_date = Date.today
    start_date = end_date - days

    uri = URI("#{@base_url}/historical")
    uri.query = URI.encode_www_form(
      from: start_date.iso8601,
      to: end_date.iso8601
    )

    request = make_request(uri)
    response = execute_request(uri, request)
    JSON.parse(response.body, symbolize_names: true)
  end

  def count_consecutive_days(historical, current_structure)
    # Count how many consecutive days market has been in current structure
    consecutive = 0
    historical.reverse_each do |day|
      break if day[:structure] != current_structure
      consecutive += 1
    end
    consecutive
  end

  def calculate_structure_strength(analysis)
    # Measure strength of contango/backwardation
    front_premium = analysis[:front_month_premium].abs

    case
    when front_premium > 1.0
      'STRONG'
    when front_premium > 0.5
      'MODERATE'
    when front_premium > 0.25
      'WEAK'
    else
      'FLAT'
    end
  end

  def detect_changes(historical)
    changes = []
    previous = nil

    historical.each do |day|
      if previous && previous[:structure] != day[:structure]
        changes << {
          date: day[:date],
          from: previous[:structure],
          to: day[:structure]
        }
      end
      previous = day
    end

    changes
  end

  def generate_alerts(current, historical)
    alerts = []

    # Alert if structure recently changed
    if detect_changes(historical.last(5)).any?
      alerts << "Structure changed in last 5 days"
    end

    # Alert if structure is extreme
    if current[:front_month_premium].abs > 1.5
      alerts << "Extreme #{current[:structure]} detected"
    end

    # Alert if approaching expiry
    # Add more alert conditions as needed

    alerts
  end

  def make_request(uri)
    request = Net::HTTP::Get.new(uri)
    request['Authorization'] = "Token #{@api_key}"
    request
  end

  def execute_request(uri, request)
    Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
      http.request(request)
    end
  end
end

# Usage
monitor = MarketStructureMonitor.new('YOUR_API_KEY')
analysis = monitor.monitor_structure_changes

puts "Market Structure: #{analysis[:current_structure]}"
puts "Days in Structure: #{analysis[:days_in_current]}"
puts "Structure Strength: #{analysis[:strength]}"
analysis[:alerts].each { |alert| puts "⚠️  #{alert}" }

Trading Strategies

1. Calendar Spread Trading

  • Monitor front-back month spreads
  • Trade mean reversion when Z-score exceeds ±2
  • Use historical percentiles for entry/exit

2. Curve Roll Trading

  • Calculate implied roll yields
  • Enter positions when roll yield is favorable
  • Monitor structure changes for reversals

3. Contango/Backwardation Plays

  • Long positions in backwardation
  • Storage plays in steep contango
  • Structure change momentum trades

Error Handling

No Data Available

{
  "error": "No futures data available. Scraping initiated, please try again in a few seconds.",
  "status": 503
}

Invalid Contract Format

{
  "error": "Invalid contract format. Use YYYY-MM format (e.g., 2025-11)"
}

Invalid Date Range

{
  "error": "Date range exceeds maximum allowed (365 days)"
}

Data Quality

  • Real-time data during ICE trading hours (01:00-23:00 GMT)
  • 5-minute update frequency
  • Historical data retained for 30 days
  • Settlement prices updated daily at 19:30 GMT

Next Steps

  • All Prices Endpoint
  • Historical Data API
  • Marine Fuels API
Prev
Marine Fuels API