Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Seasonal + Value

This is a modified version of Young Quant's idea and Jeremy Steele's code. But with O'Shaughnessy's VC2

This is the strangest looking curve ever. It sidesteps the volatility of 2011/2012 which has plagued all my other value algorithms. However, it also dampens the 2013 monstrous rebound.

I rather like this algo, so strange that it works... Maybe when I have time I'll have another piece of code that randomly generates the months to buy to see if it simply benefits from temporal diversification.

5 responses

TLT's performance has really be derived from the fact that interest rates have been going down for the past 3 decades. I don't think we can expect to get the same performance in the future from TLT as we have in the past.

Here is the algo that puts only 0.05% into TLT. Why 0.05%? because if I switch the stock to BIL or erase that line all together, the code does nothing! I'm sure it's a bug server-side because it won't even print any of the logs on any if conditions.

Anyway, Performance is a bit more meh. Heh it's such a funny looking curve.

Good one JW, not much negative cash so the curve is close to real. (Not that negative cash is somehow in itself bad, margin can be fine when utilized intentionally, the point is to be aware of it since it matters in live/real trading and the fund).
Anyway, here's a stair-step making major increases easy to spot:

def handle_data(context, data):

    if 'maxlvrg' not in context: context.maxlvrg = 0  
    if context.account.leverage > context.maxlvrg:  
        context.maxlvrg = context.account.leverage  
        record(maxlvrg = context.maxlvrg)  # Record any new leverage high  

Thanks Gary,
I will start to put that into my regular code.

Cool adaptation of the seasonal algo. Too bad fundamentals can't be used in live trading.

Fundamentals can be used in live trading :)

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.