read.stefanangrick

Visualising Asian bond markets data using R

The AsianBondsOnline portal of the ASEAN+3 Asian Bond Markets Initiative (ABMI) provides a wealth of information on Asian bond markets, including market size, currency of denomination, pricing information, and liquidity statistics, among others. I need to get a quick overview of the market every few months, so I put together a little R script to do the job for me. The script gets the latest data on local currency bonds and foreign currency bonds from AsianBondsOnline, aggregates the data for government bonds and corporate bonds and outputs the result as static and interactive graphs.px.gif

Grab the script here and open it in your favourite R IDE. The script is structured into short sections, the first of which loads packages required for the script to work. All packages listed here need to be present on your system, so if you don't have, say, RCurl installed, you will first need to run install.packages("RCurl") before proceeding. Next, we grab the data we need from AsianBondsOnline, specifically their data on the size of local currency and foreign currency bond markets. We merge both sets and subset the data before moving to the next section, where we calculate bonds outstanding relative to GDP. Finally, we plot the result using the excellent ggplot2 package. Of course, a static image only tells you so much, which is why we also generate an interactive plot using plotly, which can be found here. Clicking on the legend keys in the interactive graph will allow you to enable/disable specific series temporarily, to get an idea of which series drive changes in the totals.

Get the R script here

Asian bond market data

Links