Hi,
I'm trying to do something similar to a 190/90 fund in an algorithm. To be more specific, I'd like to do something similar to the DollarNeutral constraint, but I'd like the long side to actually be double the exposure of the short side, instead of the same as in the DollarNeutral constraint. Here's what I have:
def rebalance(context, data):
objective = opt.TargetWeights(context.pipeline_data["alpha"])
max_leverage = opt.MaxGrossExposure(3)
net_exposure = opt.NetExposure(0.95, 1.05)
algo.order_optimal_portfolio(
objective=objective,
constraints=[
max_leverage,
net_exposure,
]
)
Does this look about right?