Great course, however there is a big problem with the software, if a given asset has NO trades during the testing period there is an error of mismatch.
I tried to test 50 assests, but once the program encounters an asset that does not generate trades, there is an error
How to fix the backtesting modules to skip to the next assest if the current one does not generate trades?
alueError Traceback (most recent call last) Input In [181], in <cell line: 1>() 310 current_position = 0 312 # Define the names of columns in 'trade_sheet' dataframe --> 313 trade_sheet.columns = ['Position', 'Entry Date', 314 'Entry Price', 'Exit Date', 'Exit Price'] 316 trade_sheet.tail() 317 """ 318 We will create a function `backtest_trade_sheet` to perform the above steps. 319 (...) 335 This function is available in the `quantra_backtest.py` file of the `data_modules` folder. 336 """ File ~\anaconda3\lib\site-packages\pandas\core\generic.py:5588, in NDFrame.__setattr__(self, name, value) 5586 try: 5587 object.__getattribute__(self, name) -> 5588 return object.__setattr__(self, name, value) 5589 except AttributeError: 5590 pass File ~\anaconda3\lib\site-packages\pandas\_libs\properties.pyx:70, in pandas._libs.properties.AxisProperty.__set__() File ~\anaconda3\lib\site-packages\pandas\core\generic.py:769, in NDFrame._set_axis(self, axis, labels) 767 def _set_axis(self, axis: int, labels: Index) -> None: 768 labels = ensure_index(labels) --> 769 self._mgr.set_axis(axis, labels) 770 self._clear_item_cache() File ~\anaconda3\lib\site-packages\pandas\core\internals\managers.py:214, in BaseBlockManager.set_axis(self, axis, new_labels) 212 def set_axis(self, axis: int, new_labels: Index) -> None: 213 # Caller is responsible for ensuring we have an Index object. --> 214 self._validate_set_axis(axis, new_labels) 215 self.axes[axis] = new_labels File ~\anaconda3\lib\site-packages\pandas\core\internals\base.py:69, in DataManager._validate_set_axis(self, axis, new_labels) 66 pass 68 elif new_len != old_len: ---> 69 raise ValueError( 70 f"Length mismatch: Expected axis has {old_len} elements, new " 71 f"values have {new_len} elements" 72 ) ValueError: Length mismatch: Expected axis has 0 elements, new values have 5 elements