Back to Community
Berkshire Hathaway Not Available?

I'm trying to write an algorithm that buys Berkshire Hathaway class A and B (BRK.A and BRK.B) shares but I'm not getting any output.

def handle_data(context, data):  
    order(sid(1091),10)  
    order(sid(11100),10)  
    return  
7 responses

I agree. There is something odd about them.

The security objects show good start and end dates. But they just stop working after 2003.

BRK.A:  
    name: BERKSHIRE HATHWY INC(HLDG CO)A  
    start: 1993-01-04 05:00:00+00:00  
    end: 2013-07-08 05:00:00+00:00  
BRK.B:  
    name: BERKSHIRE HATHWY INC(HLDG CO)B  
    start: 1996-05-08 05:00:00+00:00  
    end: 2013-07-08 05:00:00+00:00  
Clone Algorithm
3
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 51db18e93bc07606cb549f0b
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.

Thanks for the post, and sorry for the difficulty.

The Berkshire Hathaway A/B stock split isn't handled by our data loader. It's a long story, but it has to do with naming conventions of BRK.A v. BRK_A - our code can handle one or the other, but not both. We have to fix the bug, then we have to do a data reloading.

There are a handful of stocks affected by this bug - MOLX and MOLXA has a similar problem.

It will take a bit to fix this one - more than a few days. I'll let you know.

Sorry again for the difficulty.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

This is now fixed, and full data for both BRK A and BRK B are now available. The data format problem which caused the issue with Berkshire Hathaway was causing similar problems with about 600-700 other stocks, and those are now all fixed as well.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Here's the full backtest with the full data run, and BRK.B multiplied by 1500 so you can track them together.

Clone Algorithm
1
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 51f052e93e518e06ada9dfee
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.

Thanks for the update. I see now that it's working.

Class B is supposed to represent 1/1500th of a share of Class B. I tried creating an algorithm that waits until these two stocks deviate some distance from their spread to go above (below) this point and make a bet that the spreads will converge.

The only problem is that I don't know how to lock in the price that I would get for the securities. I can put in a market order when the spreads are divergent but by the time its executed, the spreads could have already collapsed.

I can use limit orders but I don't know of a way I can make two limit orders conditional (fill both in one day or neither). Am I missing something here?

There is still a bug in BRK-A historical data

Clone Algorithm
1
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 571ed36398ec0d11079fdd16
There was a runtime error.

Or maybe the bug came back, due to the change in data sources used for backtesting?

It'd be really handy if such securities could be added to a list, such as security_lists.erroneous_data so that users could filter them out, until the problems are understood and fixed.