How to control position concentration?

I am new to the Q . I am doing my first algo and have some difficulty dealing with position concentration using the optimzealpha. When I run backtest, I meet 6/7 risk profiles except that I see a one day spike in positions. I am not sure how to fix that. Please help!

Here are some of the params/constraints I use:

# Constraint Parameters

MAX_GROSS_LEVERAGE = 1.0
MAX_SHORT_POSITION_SIZE = 0.025  # 1.5%
MAX_LONG_POSITION_SIZE = 0.025   # 1.5%
MIN_BETA_EXPOSURE = -0.005
MAX_BETA_EXPOSURE = 0.005
MAX_SECTOR_EXPOSURE = 0.10

constraints = []

constrain_gross_leverage = opt.MaxGrossExposure(MAX_GROSS_LEVERAGE)
constraints.append(constrain_gross_leverage)

constrain_pos_size = opt.PositionConcentration.with_equal_bounds(
-MAX_SHORT_POSITION_SIZE,
MAX_LONG_POSITION_SIZE,
)
constraints.append(constrain_pos_size)

market_neutral = opt.WeightedExposure(
min_exposures={'beta': -MAX_BETA_EXPOSURE},
max_exposures={'beta': MAX_BETA_EXPOSURE},
)
constraints.append(market_neutral)

dollar_neutral = opt.DollarNeutral(tolerance=0.001)
constraints.append(dollar_neutral)

sector_neutral = opt.NetGroupExposure.with_equal_bounds(
labels=context.sector,
min=-0.1,
max=0.1,
)
constraints.append(sector_neutral)

constrain_sector_style_risk = opt.experimental.RiskModelExposure(

)
constraints.append(constrain_sector_style_risk)


order_optimal_portfolio(
objective=objective,
constraints=constraints
)

4 responses

As prices change, the position concentration of each stock in your portfolio would change as well.

Try rebalancing more frequently, decreasing the position concentration constraint you have in (MAX_SHORT_POSITION_SIZE, MAX_LONG_POSITION_SIZE), or strengthening the alpha signal.