In reference to a previous post of mine: Force Moonshot to trade in quantities of 100 - #2 by Brian
I added the code mentioned in this post to my strategy file. We were working with a universe containing 1 stock at the time and the modification was working great in both back testing and live trading!
We moved on to back testing a universe of 39 stocks and the back test started failing. The outputted error is at the end of this post. We removed the limit_position_sizes() function and the backtest would execute successfully.
I increase our NLV from 100,000 to 1,000,000 in back testing thinking it could be failing due to a lack of cash with no success.
Error
quantrocket-moonshot-1|Traceback (most recent call last):
quantrocket-moonshot-1| File "sym://qrocket_mshot_backtest_backtest_py", line 52, in mule_backtest_strategies
quantrocket-moonshot-1| File "sym://qrocket_mshot_backtest_backtest_py", line 183, in backtest_strategies
quantrocket-moonshot-1| File "/opt/conda/lib/python3.9/site-packages/moonshot/strategies/base.py", line 1343, in backtest
quantrocket-moonshot-1| weights = self._constrain_weights(weights, prices)
quantrocket-moonshot-1| File "/opt/conda/lib/python3.9/site-packages/moonshot/strategies/base.py", line 962, in _constrain_weights
quantrocket-moonshot-1| quantities > max_quantities_for_longs, quantities)
quantrocket-moonshot-1| File "/opt/conda/lib/python3.9/site-packages/pandas/core/ops/common.py", line 69, in new_method
quantrocket-moonshot-1| return method(self, other)
quantrocket-moonshot-1| File "/opt/conda/lib/python3.9/site-packages/pandas/core/arraylike.py", line 48, in __gt__
quantrocket-moonshot-1| return self._cmp_method(other, operator.gt)
quantrocket-moonshot-1| File "/opt/conda/lib/python3.9/site-packages/pandas/core/frame.py", line 6851, in _cmp_method
quantrocket-moonshot-1| self, other = ops.align_method_FRAME(self, other, axis, flex=False, level=None)
quantrocket-moonshot-1| File "/opt/conda/lib/python3.9/site-packages/pandas/core/ops/__init__.py", line 288, in align_method_FRAME
quantrocket-moonshot-1| raise ValueError(
quantrocket-moonshot-1|ValueError: Can only compare identically-labeled DataFrame objects
Any input is welcome on next steps for troubleshooting!