Introducing My Work on the BOJ
June 12, 2024
Since 2020 I’ve had the time and curious desire to learn more about central banks and economics. Like so many others, I took an interest in markets, stocks, the Federal Reserve, and money printer memes when the pandemic lock downs and ensuing stimulus drove these things into the spotlight.
Questions around central banks and how ‘money printing’ really works, paired with plenty of time on YouTube, led me to Richard Werner’s Princes of the Yen documentary. I’d already heard about Japan’s unique economic situation in passing, and Princes of the Yen pushed the country to the top of my interests.
Another interest I had was not forgetting the skills I learned in school- namely computer science. I’d heard of Selenium Web Driver, and wanted to test it out. Using code to control a browser and pull information from websites sounded like a good skill to have, but I still needed a data set to target.
I settled on Japanese Government Bonds (JGBs) Held by the Bank of Japan (BOJ). Now, before your eyes glaze over and you exit the page, let me make my pitch for why this dataset is so interesting and important.
It’s Interesting, I Promise
First- The BOJ at many points has owned more than 100% of specific JGBs. As in 100 million worth of the specific JGB is issued, and the BOJ owns 120 million worth of that JGB.1
How does that work?
Second- The BOJ currently owns more than 50% of the JGBs that exist.2 Remember, governments issue bonds when they want to spend more than they bring in with taxes. So the BOJ is ending up with more than half the bonds the government issues to get extra spending money.
Doesn’t this mean the government is lending money to itself?
Finally- The BOJ is explicitly setting the price of JGBs by controlling their interest rates.
So, not only is the BOJ helping the government borrow money, it’s also helping the government get a good price for it.
If you’re thinking, yeah ok dude, but this is just how it works- Isn’t it crazy that this is ‘just how it works’!?
Japan’s government spends more money than they make, by a long shot, funded largely by the central bank, which decides the cost of that money by setting interest rates!
Where does the BOJ get all the money to lend to the government? They use their computer, and power as the central bank, to update a record.3
Collecting the Data
Step one of this project was collecting the data. I wrote a Python script that used Chrome Driver to open the JGBs Held by the BOJ webpage, follow all the individual links, download the data, and convert it into a CSV excel file.
It was hard.
The data goes back to 2001, and the format it is reported in changed numerous times over the years. To begin with, it was simply shared as an HTML table on the webpage. Then it became PDFs, which turned into Excel documents, which turned into Excel documents in a very different format, and so on.
Each style of reporting the JGB data meant a different function to handle the specific case. The goal was to get each report into a CSV, and have all the CSVs be formatted the same way.
You don’t always get what you want.
I found it easier to split the data into two periods, which have different CSV formats:
- June 2001 – May 2014
- April 2014 – Present
I’ve included screenshots from CSVs of each format, you can see how different they look. This is a direct representation of the change in BOJ reporting style.


The process of downloading the data in a variety of formats and standardizing it into CSVs required learning, and Googling, a lot of things. In the end, though, I had 24 years worth of reports detailing the BOJ’s JGB holdings.4
We Have the Data… Now What?
Goal one accomplished- I successfully scraped and cleaned the data using Selenium WebDriver and Python! Now what to do?
Ideas bounced around my head.
A program that shows total BOJ JGB holdings on each reporting date… A program that shows all changes to the BOJ holdings since the last reporting period… An interactive program that charts any specified bond over a given time period.
I had to start somewhere. I knew I would use Python, and quickly realized any program I imagined would work best if all the data was in the same place. Two CSVs wasn’t gonna cut it.
I needed the CSV data in the Python program, ideally in a way that would be usable for all of my ideas. I started writing a program named ‘create_master_dicts.py’.
create_master_dicts.py
This program uses all the clean CSV data I downloaded, and turns it into an easy to use dictionary.
Dictionaries are a data structure that uses key-value pairs. The way I structed the master dictionary was to create a key for each csv, with its value being a dictionary for each bond type and holding value reported in the csv. See this example:
master_dictionary = {csv1: {bondType1-cusip1: value, bondType1-cusip2: value, bondType1-cusip3: value, …, bondType1: totalvalue, BondType2-cusip1: value, …}, csv2: { … }, csv3: { … }, … }.
Once the master dictionary is created, it’s trivial to get very specific information. Using the master dictionary all the earlier ideas are achievable without too much effort.
A program that shows total BOJ JGB holdings on each reporting date… A program that shows all changes to the BOJ holdings since the last reporting period… An interactive program that charts any specified bond over a given time period.
Once You Have the Keys, Where do You Go?
Each step up to this point was clear cut: download the data to CSVs, load the CSVs into a master dictionary. There was lots of error checking and edge cases, but I knew when the job was done.
Now that I have every JGB holding report by the BOJ at my fingertips, where to go?
General exploration tools were my first choice. In my opinion the most open ended exploration tool I’ve created so far, and thus the best, is ‘jgb_holding_chart.py’.
This program uses the master dictionary to create charts. These charts can be for all JGBs held by the BOJ, a specific bond type (2-year, 30-year, etc), or a specific CUSIP (10Y-368 for example). The user can specify a start date and if they want to save the chart or not.

This has meant getting proficient in Pandas, and Matplotlib, tools I had little experience with.
Another exploration program I wrote is titled ‘cusip_inspector.py’. The program takes a bond type or CUSIP, as well as a start and end date. With the input it shows the change in holdings for the specified JGB since the last report, for each report, released between the start and end dates.

The final exploration program I have right now (‘largest_difference_report.py’) is a little more in the weeds. I was curious, what are the BIGGEST changes in holding values that have happened between two consecutive reports? The program outputs the 10 largest changes in JGB holding value for 2, 5, 10, 20, and 30 year JGBs, and the date they occurred.

Going Forward
There are still tons of unanswered questions and interesting ways to extend this project. Some potential avenues are:
- Exploring how JGB holdings of the BOJ changed around key currency and policy dates.
- Adding total issuance of each JGB CUSIP to evaluate how frequently the BOJ has held more than 100% of a CUSIP.
- Exploring rate of holding changes since the new BOJ governor Kuroda took power.
- Adding interest rate data to explore the relationship between rate moves and report dates.
- Exploring the holdings with an eye towards on-the-run (new) vs off-the-run (old) JGBs.
- Looking at an x-month period, starting with each report, and seeing which periods have the greatest and least increase in holdings.
I’m excited to share this project and keep investigating the data. I have and will continue to learn new skills, and while very, very few people are interested in this kind of thing, it is important!
Japan’s 2024 budget is 24% servicing the national debt, and a large part of the budget is funded by issuing new debt.5 While Japan is deepest down the rabbit hole, the US and other countries are following this path of deficit spending, growing national debt, and the central bank increasing bond holdings.
Funding spending with new debt that is then purchased by the central bank, who is also pricing the debt with interest rate policy, is not sustainable or in the interest of normal citizens. We should be asking our politicians to spend responsibly, just as we expect of fellow citizens. They’ll only do that when more people understand what is happening, and care.
Until next time,
Dillon
Footnotes
- Bloomberg, Nikkei Asia ↩︎
- Statista, Nippon ↩︎
- It is a little more complicated than this. The BOJ usually buys from big Japanese banks, which are required to buy from the government. These banks know they can turn around and sell to the BOJ for a small profit, so they have no problem. This system makes things a little more complicated and it looks less like the BOJ directly funding Japanese government spending. To buy from the banks, the BOJ credits them with ‘bank reserves’, which are comparable to an ‘in-game currency’- They work in the banking system (or game) but you cant spend them in the real world. The bank reserves are created using a computer system and updating a ledger. This is what we think of as ‘money printing’. Bank reserves are useful to the banks because they allow them to make more loans, which does create money in the real world. ↩︎
- At least, I had most of it. The period from October 2010 – May 2014 turned out to be extremely messy, thanks to the PDF formatting. These reports I simply skipped, moving on to exploring the data, before going back over a year later to clean it, and finally complete the dataset. ↩︎
- Ministry of Finance ↩︎
Leave a Reply
You must be logged in to post a comment.