Back to Community
IVV - Core S&P 500 ETF VS Bond ETF Dollar neutral strategy

Replaced SPDR with Core

Top Ten Holdings

Exxon Mobil Corporation XOM: 2.79%
Apple Inc AAPL: 2.58%
Microsoft Corporation MSFT: 1.80%
Johnson & Johnson JNJ: 1.68%
General Electric Co GE: 1.67%
Google, Inc. Class A GOOG: 1.64%
Chevron Corp CVX: 1.59%
Procter & Gamble Co PG: 1.47%
Berkshire Hathaway Inc Class B BRK.B: 1.42%
Wells Fargo & Co WFC: 1.41%
%Assets in Top 10: 18.05% Total Holdings: 503.0

Clone Algorithm
305
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: 529d5c90a36733075600bd4c
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.
9 responses

12/9/2013 with leverage constrained

Clone Algorithm
305
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: 52a66b0dc3ca3207668f673c
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.

Dear sir,

I clone the strategy and do the backtest, But I got "41 Error Runtime exception: ZeroDivisionError: float division by zero",
I cannot figure out what is wrong for me, some one could help .

Hello,

I would like to know what causes this as well. I have used a try/except workaround but even that makes no sense to me as nothing is ever printed out.

P.

Clone Algorithm
7
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: 53413362dbeac9072310438c
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.

It is an (insidious) "Build Error" reported as a runtime exception. The issue is that the backtester performs kind of pseudo-run of the code and it can trigger errors (but logging is suppressed, so de-bugging a "Build Error" can be tricky).

Here's a fix. If cash goes to zero, there will be a problem with:

go=(buy/buys)  

since:

buy =(context.portfolio.cash * .025)/price  
buys =(context.portfolio.cash * .025)/sp  

The algebraic equivalent works:

go = sp/price  

By the way, looking at the performance of the algo, this appears to be another manifestation of "avoid the 2008-2009 disaster" but it doesn't appear to be viable going forward (unless, of course, we have another similar disaster).

Grant

Clone Algorithm
49
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: 53414170b82dd0071b8a111b
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.

Hello Grant,

I'm, as ever, confused. This works:

        buy =(context.portfolio.cash * .025)/price  
        buys =(context.portfolio.cash * .025)/sp  
        if context.portfolio.cash == 0:  
            print "Cash = 0 !"  
            go=(buy/1)  
        else:  
            go=buy/buys  

but cash never goes to zero. It feels like a build-time bug to me. And, of course, the algo ran without issue in December.

P.

I think that the Quantopian team will have to shed some light on this one. I've had trouble before with mysterious build errors. I don't think that the code actually gets run as we see it run. When you say that the cash never goes to zero, how do you know it is not zero when the build check is done? Since the log output is suppressed during the build, there is no way to know. You won't see 'Cash = 0 !' on the log screen, but your if-else statement prevents the build error (this is similar to a work-around I've had to apply). --Grant

@Peter and @Grant: I'd bet that in quantopian's pre-run code inspection cash is zero, thus they get a divide by zero during that check. and for security reasons they simply report it as "build error"

Hi,

There's a bug in our validation code. We'll try to get it fixed soon and post here when the fix is released. Thanks for letting us know.

jik

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.

The bug is now fixed! The algorithm should run as expected, thanks for pointing it out to us.

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.