Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Is this worth investing?

Hi Q,

Is this strategy worth investing? If yes, what is the process to get it funded?

Best regards,
Pravin

15 responses

No b/c leverage so high means the great looking curve is an illusion. Return on the amount spent is 59%, lower than the benchmark.

This is a minimal version for keeping an eye on PvR that will usually work by just pasting this at the end of initialize() [or depending on how ordering is being done, sometimes you might need to call info() more often, like from from handle_data()]

    schedule_function(info, time_rules.market_close())

def info(context, data):  
    c = context                           # For brevity

    shorts = 0                            # Shorts value  
    for p in c.portfolio.positions:       # Total up shorting, because it is risk  
        shrs = c.portfolio.positions[p].amount  
        if shrs < 0:  
            shorts += int(abs(shrs * data[p].price))

    if 'risk_hi' not in c: c.risk_hi = 0  # Init this in initialize for better efficiency  
    cash_dip  = int(max(0, c.portfolio.starting_cash - c.portfolio.cash)) # all of these as positives  
    risk      = int(max(cash_dip, shorts))  
    c.risk_hi = max(risk, c.risk_hi)

    # Profit_vs_Risk returns based on max amount actually put into play (risk high)  
    if c.risk_hi != 0:  # Avoid zero-divide  
        pvr_rtrn = 100 * (c.portfolio.portfolio_value - c.portfolio.starting_cash) / c.risk_hi  
        record(PvR = pvr_rtrn)  # Profit_vs_Risk returns  

In this backtest I just remove 'HBI', as it has wrong split adjustment.

If the performance holds up using a dynamic universe, it might be on to something? Backtests with fixed lists of assets, if they aren't an unbiased set of ETFs (like all the sector ETFs, or all the country ETFs) make me pretty skeptical. But I am not Quantopian!

Pravin,

How you pick up instruments?

@Vladimir, I had this list for a while now. Don't remember anymore how I obtained it.

(deleted previous post, fixed the error) Backtesting very slowly on dynamic universe...

@James Miller, since the algo longs stocks and shorts SPY, you might want to try and pick winning stocks from dynamic universe. Alternatively you could remove the bounds in minimize method to find a long short portfolio.

Best regards,
Pravin

Heres the test without Pravins suggestions.

And with more acceptable leverage.

how does the dynamic universe make such a difference?
Best,
Andrew

Selection bias.

I changed James' version slightly:

  • Universe consists of 9 out of 11 SPDR sector ETFs (per Simon's suggestion. Note: I couldn't find XLFS and XLRE in SID)
  • Tracking Max Leverage
  • Turned simulated slippage back on

Hi Pravin,

Could you please explain a little bit your idea behind this algo?

Many thanks!

Hi Thomas,

Thanks for bringing my attention this algorithm. It has some obvious errors. I will post a new back test with dynamic universe and an explanation today or tomorrow once I fix the errors.

Best regards,
Pravin

Hi Pravin,

have you fixed the error already? :-)

Thomas