Skip to content
All library documents

Reading Berkshire Hathaway Class B Data with quantmod

Article Quant Q&A · Author: Daryl

Summary

This short exchange addresses a data-import error when retrieving Berkshire Hathaway Class B prices through R’s quantmod package. The ticker contains a hyphen, and the question reports that the request returned an HTTP 404 error. The reply suggests checking the installed quantmod version and reports that the request worked with version 0.4.23.

The example shows that the downloaded price series uses dotted column names such as BRK.B.Open and BRK.B.Close. It also notes that the resulting object can be retrieved using the ticker name. This is a practical troubleshooting example for fetching equity data, rather than a trading method or market analysis. The evidence is a reported successful retrieval and sample rows from the returned series; the exchange does not establish which earlier package versions fail, explain the underlying change, or compare data providers.

Key ideas

  • Check the quantmod package version when a ticker request fails.
  • The exchange reports that version 0.4.23 successfully retrieved Berkshire Hathaway Class B data.
  • The downloaded series uses dotted column names for price and volume fields.
  • The example covers data retrieval only and gives no trading analysis.

Tags

Full text
# Berkshire Hathaway ticker symbol B


# Berkshire Hathaway ticker symbol B












I want to read the Berkshire Hathaway data using the getSymbols function in the quantmod package in R.

The ticker symbol is BRK-B.

```
getSymbols ( "BRK-B" )
```

yields the error message:

```
Error in getSymbols.yahoo(Symbols = "BRKB", env = <environment>, verbose = FALSE,  : 
  Unable to import “BRKB”.
HTTP error 404.
```

There is something about that hyphen!

How do I correct things?

## Answer by Enrico Schumann (score 3)

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

What version of the `quantmod` package are you using? With 0.4.23, it works for me:

```
library("quantmod")
getSymbols("BRK-B") 
get("BRK-B") ## or `BRK-B`
##            BRK.B.Open BRK.B.High BRK.B.Low BRK.B.Close BRK.B.Volume BRK.B.Adjusted
## 2007-01-03      73.56      73.72     72.60       72.86      1385000          72.86
## 2007-01-04      72.86      72.94     72.06       72.20      1070000          72.20
## 2007-01-05      72.66      72.66     71.26       71.56       930000          71.56
## ....
```

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.