The Autodidacts

Exploring the universe from the inside out

I couldn’t find a free Silver price API — so I’m making one

Writing a web app because I want to do calculations in a spreadsheet

Note: this post is part of #100DaysToOffload, a challenge to publish 100 posts in 365 days. These posts are generally shorter and less polished than our normal posts; expect typos and unfiltered thoughts! View more posts in this series.

A little while ago, I went looking for a machine-readable source of precious metal price data to pull into a financial worksheet.

I’m not a trader who needs super-accurate, to-the-second data. I just want to know the spot price for the day without Googling it.

There are various paid APIs for fancy people whose jobs/businesses/net worths depend on the prices of precious metals, which probably work great. But for the rest of us?

Everyone seems to recommend XMLChart’s API:

https://xmlcharts.com/precious-metals.php

It’s maybe technically free? Maybe I’m dumb, but I couldn’t get it to work. And there’s no point in using an API if figuring out how to use it is harder that writing your own, from scratch!

My API is going to freakishly basic. I will check the price once per day rather than every minute. And I will provide two currencies, CAD and USD, at two different endpoints:

/api/v1/silver/bid/day/CAD.json

/api/v1/silver/bid/day/USD.json

The endpoints are going to return … drumroll pleasea single number.

And probably I’ll add one more:

/api/v1/silver/bid/day/updated-at.json

... returning a UTC ISO 8601 timestamp (date -u –iso-8601=ns), which might be off by a few minutes from the exact moment that the prices were fetched, but will tell you if the API is dead, or if you already have the data for the day.

I might add an RSS endpoint as well, I haven’t decided yet.

Use this form to join the waitlist and get access (free!) as soon as it’s live:

And it’s going to be hosted on GitHub pages. Hit it as often as you like 🔥.

Sign up for updates

Join the newsletter for curious and thoughtful people.
No Thanks

Great! Check your inbox and click the link to confirm your subscription.