I'm in the process of converting my manual order algorithm and replacing it with the order_optimal_portfolio.
I am currently using the style=StopOrder to ensure that I sell under certain pricing conditions.
Any help would be greatly appreciated.
I'm in the process of converting my manual order algorithm and replacing it with the order_optimal_portfolio.
I am currently using the style=StopOrder to ensure that I sell under certain pricing conditions.
Any help would be greatly appreciated.
That seems crazy from a contest perspective. Quantopian completely eliminates the ability to develop creative algorithms for selling at specific price thresholds....
@Steve... I second what you said. I've been struggling to create code that follows Q's requirements. Had some creative algos with good return, good alpha, good beta, etc. Got disqualified from the contest because my leverage dropped below 0.7!? Tried to fix it different ways but can't seem to put this puzzle together. I wonder with so many requirements, how many algos make the cut. (using order_optimal_portfolio).
Good luck
PC
@ Paulo -
One way to force the leverage to 1.0 is to use:
weights = opt.calculate_optimal_portfolio(
objective=objective,
constraints=constraints,
)
weights = weights - weights.mean()
weights = weights/weights.abs().sum()
objective = opt.TargetWeights(weights)
order_optimal_portfolio(
objective=objective,
constraints=[],
)
Basically, run the optimizer, demean and normalize, and then run again unconstrained. No guarantee you won't get disqualified for other infractions, but at least the leverage problem should be fixed.