darman84 / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
0 stars 0 forks source link

invalid instrument id format #1

Open darman84 opened 3 days ago

darman84 commented 3 days ago

examples\backtest\ib_download_and_backtest.py gives the following error upon running:

Error sending log event: [ERROR] EMACross: EMACross(EMACross-000): Error on START TypeError(Argument 'instrument_id' has incorrect type (expected nautilus_trader.model.identifiers.InstrumentId, got str)) Traceback (most recent call last): File "nautilus_trader\common\component.pyx", line 1717, in nautilus_trader.common.component.Component.start self._trigger_fsm( File "nautilus_trader\common\component.pyx", line 1943, in nautilus_trader.common.component.Component._trigger_fsm action() File "nautilus_trader\trading\strategy.pyx", line 332, in nautilus_trader.trading.strategy.Strategy._start cpdef void _start(self): File "nautilus_trader\trading\strategy.pyx", line 378, in nautilus_trader.trading.strategy.Strategy._start self.on_start() File "nautilus_trader\trading\strategy.pyx", line 203, in nautilus_trader.trading.strategy.Strategy.on_start cpdef void on_start(self): File "C:\Users\Zack\AppData\Roaming\Python\Python312\site-packages\nautilus_trader\examples\strategies\ema_cross.py", line 121, in on_start self.instrument = self.cache.instrument(self.instrument_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error sending log event: [ERROR] BACKTESTER-001: Trader(BACKTESTER-001): Error on START TypeError(Argument 'instrument_id' has incorrect type (expected nautilus_trader.model.identifiers.InstrumentId, got str)) Traceback (most recent call last): File "nautilus_trader\common\component.pyx", line 1717, in nautilus_trader.common.component.Component.start self._trigger_fsm( File "nautilus_trader\common\component.pyx", line 1943, in nautilus_trader.common.component.Component._trigger_fsm action() File "C:\Users\Zack\AppData\Roaming\Python\Python312\site-packages\nautilus_trader\trading\trader.py", line 250, in _start strategy.start() File "nautilus_trader\common\component.pyx", line 1701, in nautilus_trader.common.component.Component.start cpdef void start(self): File "nautilus_trader\common\component.pyx", line 1724, in nautilus_trader.common.component.Component.start raise # Halt state transition File "nautilus_trader\common\component.pyx", line 1717, in nautilus_trader.common.component.Component.start self._trigger_fsm( File "nautilus_trader\common\component.pyx", line 1943, in nautilus_trader.common.component.Component._trigger_fsm action() File "nautilus_trader\trading\strategy.pyx", line 332, in nautilus_trader.trading.strategy.Strategy._start cpdef void _start(self): File "nautilus_trader\trading\strategy.pyx", line 378, in nautilus_trader.trading.strategy.Strategy._start self.on_start() File "nautilus_trader\trading\strategy.pyx", line 203, in nautilus_trader.trading.strategy.Strategy.on_start cpdef void on_start(self): File "C:\Users\Zack\AppData\Roaming\Python\Python312\site-packages\nautilus_trader\examples\strategies\ema_cross.py", line 121, in on_start self.instrument = self.cache.instrument(self.instrument_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Traceback (most recent call last): File "j:\COSC Freelance Projects\nautilus_trader\examples\backtest\ib_download_and_backtest.py", line 169, in run_backtest() File "j:\COSC Freelance Projects\nautilus_trader\examples\backtest\ib_download_and_backtest.py", line 135, in run_backtest engine.run() File "nautilus_trader\backtest\engine.pyx", line 939, in nautilus_trader.backtest.engine.BacktestEngine.run self._run(start, end, run_config_id) File "nautilus_trader\backtest\engine.pyx", line 1086, in nautilus_trader.backtest.engine.BacktestEngine._run self._kernel.start() File "C:\Users\Zack\AppData\Roaming\Python\Python312\site-packages\nautilus_trader\system\kernel.py", line 888, in start self._trader.start() File "nautilus_trader\common\component.pyx", line 1701, in nautilus_trader.common.component.Component.start cpdef void start(self): File "nautilus_trader\common\component.pyx", line 1724, in nautilus_trader.common.component.Component.start raise # Halt state transition File "nautilus_trader\common\component.pyx", line 1717, in nautilus_trader.common.component.Component.start self._trigger_fsm( File "nautilus_trader\common\component.pyx", line 1943, in nautilus_trader.common.component.Component._trigger_fsm action() File "C:\Users\Zack\AppData\Roaming\Python\Python312\site-packages\nautilus_trader\trading\trader.py", line 250, in _start strategy.start() File "nautilus_trader\common\component.pyx", line 1701, in nautilus_trader.common.component.Component.start cpdef void start(self): File "nautilus_trader\common\component.pyx", line 1724, in nautilus_trader.common.component.Component.start raise # Halt state transition File "nautilus_trader\common\component.pyx", line 1717, in nautilus_trader.common.component.Component.start self._trigger_fsm( File "nautilus_trader\common\component.pyx", line 1943, in nautilus_trader.common.component.Component._trigger_fsm action() File "nautilus_trader\trading\strategy.pyx", line 332, in nautilus_trader.trading.strategy.Strategy._start cpdef void _start(self): File "nautilus_trader\trading\strategy.pyx", line 378, in nautilus_trader.trading.strategy.Strategy._start self.on_start() File "nautilus_trader\trading\strategy.pyx", line 203, in nautilus_trader.trading.strategy.Strategy.on_start cpdef void on_start(self): File "C:\Users\Zack\AppData\Roaming\Python\Python312\site-packages\nautilus_trader\examples\strategies\ema_cross.py", line 121, in on_start self.instrument = self.cache.instrument(self.instrument_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: Argument 'instrument_id' has incorrect type (expected nautilus_trader.model.identifiers.InstrumentId, got str)

github-actions[bot] commented 3 days ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 3 days ago

The workflow to fix this issue encountered an error. Openhands failed to create any code changes.

github-actions[bot] commented 3 days ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 3 days ago

An attempt was made to automatically fix this issue, but it was unsuccessful. A branch named 'openhands-fix-issue-1' has been created with the attempted changes. You can view the branch here. Manual intervention may be required.