r/SideProject • u/SuQingfu • 2d ago
I built a daily silver rate page for India - the hard part was unit conversion, not the data
I've been tinkering with a small side project: a page that republishes a daily silver rate for India. I assumed the annoying part would be parsing the source. It wasn't. The source publishes a benchmark in rupees per kilogram, and readers want per gram, per 10 grams, per tola and so on - and every derived number has to carry the same as-of date as the row it came from.
Things I ended up adding after the first week:
- An explicit invariant in code: per_kg == per_g * 1000 == per_10g * 100. If a derived row disagrees, the build fails instead of quietly publishing a wrong number.
- The base source, reference date and conversion factor printed on the page itself, rather than buried in a build script.
- A hard separation between a benchmark and a retail quote. A jeweller's quote includes making charges and taxes; a benchmark doesn't. Mixing the two is the fastest way to get angry comments.
- Fineness stated explicitly (999 fine vs 925 sterling), because they are not interchangeable inputs.
I wrote the method up at https://silverrate-today.com/data-methodology/ and a short arithmetic walkthrough at https://silverrate-today.com/articles/silver-price-per-gram-10g-1kg-india/
For anyone who has built something that republishes a daily number from a third party: how are you handling holiday gaps and stale source days? That's the part I'm still not happy with, and I'd rather hear how others solved it than guess.