Skip to main content
GET
https://stocks-dev.up.railway.app
/
api
/
v1
/
commodities
curl -X GET "https://stocks-dev.up.railway.app/api/v1/commodities?commodity_type=energy" \
  -H "X-API-Key: your_api_key"
{
  "commodities": [
    {
      "symbol": "CL=F",
      "name": "Crude Oil WTI",
      "price": 78.45,
      "change": 1.23,
      "changesPercentage": 1.59,
      "unit": "per barrel",
      "category": "energy",
      "lastUpdated": "2024-01-19T15:30:00Z"
    },
    {
      "symbol": "BZ=F",
      "name": "Brent Crude Oil",
      "price": 82.67,
      "change": 0.89,
      "changesPercentage": 1.09,
      "unit": "per barrel",
      "category": "energy",
      "lastUpdated": "2024-01-19T15:30:00Z"
    },
    {
      "symbol": "NG=F",
      "name": "Natural Gas",
      "price": 2.845,
      "change": -0.125,
      "changesPercentage": -4.21,
      "unit": "per MMBtu",
      "category": "energy",
      "lastUpdated": "2024-01-19T15:30:00Z"
    }
  ],
  "timestamp": "2024-01-19T15:30:00Z"
}
Get real-time and historical prices for major commodities across energy, metals, and agricultural sectors.

Parameters

commodity_type
string
default:"all"
Type of commodities to retrieve:
  • all: All commodities
  • energy: Oil, gas, coal
  • metals: Gold, silver, copper, etc.
  • agriculture: Wheat, corn, soybeans, etc.

Response

commodities
array
Array of commodity price data
timestamp
string
When the data was retrieved
curl -X GET "https://stocks-dev.up.railway.app/api/v1/commodities?commodity_type=energy" \
  -H "X-API-Key: your_api_key"
{
  "commodities": [
    {
      "symbol": "CL=F",
      "name": "Crude Oil WTI",
      "price": 78.45,
      "change": 1.23,
      "changesPercentage": 1.59,
      "unit": "per barrel",
      "category": "energy",
      "lastUpdated": "2024-01-19T15:30:00Z"
    },
    {
      "symbol": "BZ=F",
      "name": "Brent Crude Oil",
      "price": 82.67,
      "change": 0.89,
      "changesPercentage": 1.09,
      "unit": "per barrel",
      "category": "energy",
      "lastUpdated": "2024-01-19T15:30:00Z"
    },
    {
      "symbol": "NG=F",
      "name": "Natural Gas",
      "price": 2.845,
      "change": -0.125,
      "changesPercentage": -4.21,
      "unit": "per MMBtu",
      "category": "energy",
      "lastUpdated": "2024-01-19T15:30:00Z"
    }
  ],
  "timestamp": "2024-01-19T15:30:00Z"
}

Commodity Categories

Energy

  • Crude Oil WTI: West Texas Intermediate crude oil
  • Brent Crude: International crude oil benchmark
  • Natural Gas: Natural gas futures
  • Heating Oil: Heating oil futures
  • Gasoline: Gasoline futures

Metals

  • Gold: Gold spot price
  • Silver: Silver spot price
  • Copper: Copper futures
  • Platinum: Platinum spot price
  • Palladium: Palladium spot price

Agriculture

  • Wheat: Wheat futures
  • Corn: Corn futures
  • Soybeans: Soybean futures
  • Sugar: Sugar futures
  • Coffee: Coffee futures
  • Cotton: Cotton futures

Use Cases

  • Portfolio Diversification: Add commodity exposure
  • Inflation Hedging: Track inflation-sensitive assets
  • Economic Analysis: Monitor economic indicators
  • Trading Opportunities: Identify commodity trends
  • Risk Management: Hedge commodity price exposure

Price Units

Different commodities are quoted in different units:
  • Oil: Per barrel (42 gallons)
  • Natural Gas: Per MMBtu (million British thermal units)
  • Gold/Silver: Per troy ounce
  • Agricultural: Per bushel or per pound

Data Source

This endpoint uses Financial Modeling Prep (FMP) commodity data with real-time pricing from major exchanges.

Notes

  • Prices are updated throughout trading hours
  • Some commodities trade 24/7, others have specific hours
  • Prices may include storage, transportation, and delivery costs
  • Consider seasonal patterns for agricultural commodities
  • Energy prices are highly volatile and news-sensitive