Skip to content
All library documents

Finding Bond Yield Data and Checking Database Coverage

Article Quant Q&A · Author: Koval Boris

Summary

The document describes how to locate bond yield datasets for analysis in R. It recommends searching a financial data catalog for yield series, identifying a dataset such as a US Treasury yield curve, and retrieving it over a chosen date range in a time-series format. This is a general workflow for finding and downloading available yield data rather than a method for estimating yields.

The example also shows why a security identifier may not return a result: the requested Austrian bond ISIN was not found in the searched database. Users should verify that the source covers the instrument they need and consider another database if it does not. Access restrictions can also affect retrieval; the answer notes that higher call limits or premium datasets may require an account API key. The guidance is specific to the named catalog and R interface in the discussion, so current availability, package behavior, and access rules may differ.

Key ideas

  • Search a financial data catalog for yield datasets before trying to download a specific series.
  • A catalog result provides a dataset identifier that can be used to request a time series over a date range.
  • Check whether a provider covers the bond or identifier of interest when a query returns no dataset.
  • Some data access limits or premium series may require account authentication.

Tags

Full text
# Download bond yields R


# Download bond yields R












I need to download bonds yields using R.

I tried, as usual, I did for stocks:

spc <- new.env()

setDefaults(getSymbols,src="FRED")

getSymbols("^AT0000386198", env = spc, from = "2010-01-01", to = "2012-03-01", return.class = "xts")

But it doesn't work. How should I proceed?

Many thanks!

## Answer by skoestlmeier (score 0, accepted)

https://quant.stackexchange.com/a/38034

You can search for certain yield curves in the FRED database with the following query:

```
require('Quandl')
Quandl.search(query = 'yield') # searching for the term 'yield'
```

You get the unique identifier for each search result, e.g. the code "USTREASURY/YIELD" for US-Yield Curve Rates. You can proceed with

```
data <- Quandl('USTREASURY/YIELD', type = 'xts',
              start_date = '2010-01-01', end_date = '2012-03-01')
```

to get your data frame.

If you get error messages, there are several possible reasons. First, you should check if your required data is available in your database. You can use the query above to check, if a certain ISIN is provided in FRED. I looked your ISIN and got the result:

```
In Quandl.search(query = "AT0000386198") : No datasets found
```

Therefore i recommend alternative databases, wich are discussed here.

Other common errors are due to a missing authentication:

> To make more than 50 calls in a day, or to access a premium database, you will need to authenticate your R session by telling us your API key.

To do this, you need to create a Quandl account (free) and use the api key wich can be found on the account settings page before running further commands:

```
Quandl.api_key("YOUR_API_KEY")
```

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.