Back to Community
Can you get the specific returns from Quantopian Risk Model as your actual portfolio returns?

Hi!
I have been playing with this strategy recently, and while the strategy itself is not very good,
The specific return plot looks interesting with sharpe more than 3.
Could you actually get to these specific returns or this is just a statistical quirk,
say by going long in the strategy and short in some common return portfolio?

Loading notebook preview...
4 responses

Hi @Quant Trader,
Thanks for suggestion!
I had beta of -0.48, I dont know how to explicitly short SPY within optimizer framework,
I tried to reverse it by locking it in with optimizer at (0.44;0.52), but this did not give any interesting results, nor did my attempt to restrict it close to zero.

Any thoughts?

@evgeny, I believe this would be easy to achieve using the optimize api with risk model constraints.

If you want to do it manually you can check how much your portfolio is exposed to common risk factors using the relevant pipeline factors (please see the documentation ) and computing your new alpha weights accordingly.

I had this same problem with one of my codes, what you need to do is implement the risk model constraints, then increase the rebalance frequency. The way I did this was:

 for i in range(1, 300, 50):  
        schedule_function(allocate, date_rules.every_day(), time_rules.market_open(minutes=i+1))  

This allows rebalancing to happen more than once per day.

The risk model is implemented like this:

constrain_sector_style_risk = opt.experimental.RiskModelExposure(  
        risk_model_loadings=context.risk_loading_pipeline,  
        version=opt.Newest,  
        min_momentum = 0.0,  
        max_momentum = 0.0,  
        min_short_term_reversal = -0.00001,  
        max_short_term_reversal = 0.00001,  
        min_value = 0.0,  
        max_value = 0.0,  
        min_size = 0.0,  
        max_size = 0.0,  
        min_volatility = 0.0,  
        max_volatility = 0.0,  
    )  


    constrain_gross_leverage = opt.MaxGrossExposure(MAX_GROSS_LEVERAGE)  
    constrain_pos_size = opt.PositionConcentration.with_equal_bounds(  
        -MAX_SHORT_POSITION_SIZE,  
        MAX_LONG_POSITION_SIZE,  
    )

    market_neutral = opt.DollarNeutral()  
    sector_neutral = opt.NetGroupExposure.with_equal_bounds(  
        labels=pipeline_data.sector,  
        min=-0.00001,  
        max=0.00001,  
    )  


    order_optimal_portfolio(  
        objective=objective,  
        constraints=[  
            constrain_gross_leverage,  
            constrain_pos_size,  
            market_neutral,  
            sector_neutral,  
            constrain_sector_style_risk,  
        ],  
    )