Before we begin, several announcements:
- On February 1st, I'll start the 4th cohort of HOPPy, my Hands-on Projects in Python class. This time, every participant will create their own data dashboard, on a topic of their choosing, using Marimo. Learn more from an info session I ran earlier this week (https://www.youtube.com/watch?v=NgcE04UsJZM) or sign up at https://lernerpython.com/hoppy-4.
- My newest classes, AI-Powered Python Practice Workshop, and AI-Powered Pandas Practice Workshop, are happening on February 2nd and 9th, respectively. If you want to get better at programming and data analysis executed via Claude, then you'll love these! Join my live info session on Thursday, January 29th, by registering here: https://us02web.zoom.us/webinar/register/WN_xPv9oQPAR6-0pzk-WNnKSw
Any questions about any of these courses? Just e-mail me at reuven@lernerpython.com.
Bamboo Weekly #155: Gold
If you live in the United States, then foreign currencies aren't something you think about often: You get your salary in US dollars, you spend money in US dollars, and you invest in US dollars.
But if you live outside of the US, or if you're in the import/export business, then the dollar affects you quite a bit. A strong dollar makes it more expensive to buy American goods, or to travel to the US. If you're charging dollars for your products, then it means you've effectively raised prices.
Lately, though, the US dollar has been rather weak. This has made American goods, and anything else priced in US dollars, cheaper than they were even a year ago. Plus, that trip to the US has suddenly become less expensive. If your products are priced in dollars, then you've effectively lowered your prices.
But wait: What does it mean for the dollar to be weak? Mostly, that it takes less foreign currency than before to buy $1. Each foreign currency floats separately against the dollar, but most of them have indeed gained strength in the last year. And why would that happen? For the same reason that anything goes down in price, namely that it is less desirable. If people don't want dollars, but do want euros, then the dollar will go down relative to the euro.
Why would people not want dollars? There are lots of reasons. If fewer companies trade with the US, then there's less demand for dollars. If interest rates decline, then the dollar is a less desirable currency for savings. And of course, if the US seems less stable or friendly, then it becomes less desireable for investments.
The dollar doesn't just trade against euros, of course. It trades against many other foreign currencies -- and also against gold and silver, metals that have long been seen as precious and as stores of wealth. Countries long ago abandoned the gold standard, meaning that their currency was backed by gold. But central banks do hold onto gold, just as they own bonds and other financial instruments.
I've seen numerous articles about how much the price of gold has increased in the last year (https://www.nytimes.com/2026/01/26/business/gold-prices.html?unlocked_article_code=1.H1A.7JgU.ewZSFX7-ceMe&smid=url-share). I thought that it would be interesting to see that growth, to compare it with the change in the dollar's worth vs. other currencies, and also to look at central banks' holding of gold vs. US dollars.
Data and five questions
This week's data comes from several sources:
- The price of gold, it turns out, it a bit hard to find! However, I found a site, https://stooq.com/q/d/?s=xauusd, that does show the historical price of gold, with prices back to the late 1700s, denominated in dollars. Use the "download as CSV" link on that page to get the full historical price.
- The price of silver is similarly available at Stooq, at https://stooq.com/q/d/?s=xagusd.
- We'll also look at the proportion of US dollars that central banks own. For that, we'll look at Currency Composition of Official Foreign Exchange Reserves (COFER), a data set from the International Monetary Fund (IMF), at https://data.imf.org/en/datasets/IMF.STA:COFER .
- Finally, we'll look at changes in the gold holdings at central banks. That can be downloaded from https://www.gold.org/goldhub/data/gold-reserves-by-country, an Excel file provided by the World Gold Council.
Paid subscribers, as usual, get all of the questions and answers, as well as downloadable data files, downloadable versions of my notebooks, one-click access to my notebooks, and invitations to monthly office hours.
Learning goals for this week include Excel files, dates and times, regular expressions, filtering, joins, grouping, plotting with plotly, and correlations.
Here are this week's five questions:
- Read the historical gold prices into a data frame, treating the
Datecolumn as asdatetimevalue, and making it the data frame's index. Create a line plot showing the price of gold throughout the data set. Create a second line plot showing only from 1925 through the present day. Then create a bar plot showing the percentage change in the mean price of gold for every 5-year period. How do the last 5 years compare with historical changes in gold's price? Use theClosecolumn for these displays and calculations. - Read in silver prices. Create a scatterplot comparing gold and silver prices, including a trendline. Use the
corrmethod to see how correlated they are. What does the scatterplot tell you about the current relationship between gold and silver vs. their historical correlation?