← Projects

I put past metal prices next to the latest price

I put past metal prices beside the latest price, so developers can get daily chart data and the latest figure in one request.

I noticed past prices were easy to miss in the Bullion API docs. They were listed separately from the latest price.

I changed each metal's price request so it can return the latest saved price or daily prices for dates you choose. Someone building a chart can get both from the same request. The docs explain how to ask for past prices.

A shortened example looks like this:

{
  "metal": "gold",
  "currency": "USD",
  "unit": "troy_oz",
  "series": [
    {
      "frequency": "daily",
      "unit": "troy_oz",
      "observations": [
        { "date": "2025-07-08", "value": "3320.1" },
        { "date": "2025-07-09", "value": "3342.55" }
      ]
    }
  ]
}

Each date has one gold price, ready to plot on a chart.

I chose to return the last recorded price for each weekday. That works for a day-by-day chart, but it doesn't show how prices move during the day. You can ask for up to five years at a time; dates without an available price are left out.

Get notified when I ship something new.

A weekly newsletter on React, Next.js, AI-assisted development, and engineering. No spam, unsubscribe any time.