Skip to content

ERROR: Strategy.create_order() got an unexpected keyword argument 'type' #15

@peterboivin

Description

@peterboivin

Running on MacOS Silicon. Prep my system exactly to your README.

python tradingbot.py
Starting backtest for MLTrader...
INFO:backtest_stats:Starting backtest...
Progress |██---------------------------------------------------------------------------------------------------| 2.29% [Elapsed: 0:00:05 ETA: 0:03:38]2024-03-04 19:31:31,208: root: ERROR: Strategy.create_order() got an unexpected keyword argument 'type'
2024-03-04 19:31:31,209: root: ERROR: Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 822, in run
self._run_trading_session()
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 773, in _run_trading_session
self._on_trading_iteration()
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 286, in func_output
result = func_input(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 310, in func_output
result = func_input(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 86, in func_output
return func_input(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 388, in _on_trading_iteration
on_trading_iteration()
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/tools/decorators.py", line 62, in func_output
frame, result = call_function_get_frame(func_input, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/tools/decorators.py", line 30, in call_function_get_frame
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/peterboivin/Documents/VisualStudioProjects/MLTradingBot/tradingbot.py", line 69, in on_trading_iteration
order = self.create_order(
^^^^^^^^^^^^^^^^^^
TypeError: Strategy.create_order() got an unexpected keyword argument 'type'

Exception in thread MLTrader:
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 822, in run
self._run_trading_session()
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 773, in _run_trading_session
self._on_trading_iteration()
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 286, in func_output
result = func_input(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 310, in func_output
result = func_input(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 86, in func_output
return func_input(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 388, in _on_trading_iteration
on_trading_iteration()
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/tools/decorators.py", line 62, in func_output
frame, result = call_function_get_frame(func_input, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/tools/decorators.py", line 30, in call_function_get_frame
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/peterboivin/Documents/VisualStudioProjects/MLTradingBot/tradingbot.py", line 69, in on_trading_iteration
order = self.create_order(
^^^^^^^^^^^^^^^^^^
TypeError: Strategy.create_order() got an unexpected keyword argument 'type'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/opt/anaconda3/lib/python3.11/site-packages/lumibot/strategies/strategy_executor.py", line 835, in run
raise RuntimeError("Exception encountered, stopping BackTest.") from e
RuntimeError: Exception encountered, stopping BackTest.

Creating trades plot...

Creating indicators plot...

Creating tearsheet...
2024-03-04 19:31:31,328: root: ERROR: Not enough data to create a tearsheet, at least 2 days of data are required. Skipping

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions