I wanted to know one thing: had gold actually kept up with inflation? The gold price alone can't tell you. Gold could double over ten years and lose money to inflation while every chart looked fine.
So I added it to the Bullion API. There is now GET /v1/gold/real-price, which restates stored daily gold closes in the dollars of the most recent CPI month. A public tool charts the nominal and adjusted lines together, with the CPI basis and the formula beside them.
Choosing the price index
The easy version of this is to substitute year-on-year inflation for a price index. I used the seasonally adjusted CPI-U index levels from the Bureau of Labor Statistics instead.
The seasonal adjustment is the reason. A raw CPI series moves with the calendar, because some things cost more in one part of the year than another. Deflate a daily gold price with that and the seasonal swings show up in your real gold price as if gold were moving. Taking the seasonal pattern out first stops a false signal.
The formula is a daily gold close multiplied by the latest stored CPI index and divided by the index for that close's month. CPI is published monthly, so every day in a month uses that month's index. Where a month has no stored index yet, those closes are left out, not filled in.
The correlation came with it
In the same change I added GET /v1/gold/yield-correlation, a rolling correlation between daily gold returns and daily changes in the 10-year US real Treasury yield. It needs 90 aligned pairs before it will return a figure, and it is a description of what moved together, not a claim that one causes the other.
Both calculations are in the API documentation with the method and the source attribution.