Back to Community
How do I Keep the Leverage Above 0.8?

I tried everything I could. But I just can't fix this. I'm still quite new here. Someone please help! What can I do to keep leverage above 0.8?

I have these code in my rebalance function

    objective = opt.MaximizeAlpha(predictions_top_bottom)

    constrain_gross_leverage = opt.MaxGrossExposure(1.05)  
    constrain_pos_size = opt.PositionConcentration.with_equal_bounds(  
        -0.03,  
        +0.03,  
    )  
    market_neutral = opt.DollarNeutral(tolerance=0.01)

    if predictions_top_bottom.index.duplicated().any():  
        log.debug(predictions_top_bottom.head())

    sector_neutral = opt.NetGroupExposure.with_equal_bounds(  
        labels=context.risk_factors.Sector.dropna(),  
        # min=-0.0001,  
        # max=0.0001,  
        min=-0.2,  
        max=0.2,  
    )

    order_optimal_portfolio(  
        objective=objective,  
        constraints=[  
            constrain_gross_leverage,  
            constrain_pos_size,  
            market_neutral,  
            sector_neutral,  
        ],  
    )  
Loading notebook preview...
Notebook previews are currently unavailable.
1 response

Reduce position concentration, increase tradable universe you score, and use normalised TargetWeights instead of MaximizeAlpha.