-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR: Strategy.create_order() got an unexpected keyword argument 'type' #15
Comments
I changed it to : from advice from Strategy class: |
so you don't define the type at all? How would it know it is a bracket order then? |
I was hoping to make limit buy/sells with this code. so I need to better understand this part. |
Anyone who has the solution for the type argument error? |
Not sure if this answers your question, but I had this error and I simply got rid of the type="bracket" since the error states it is not expecting it. This allowed has allowed my program to finish. Hope this helps. order = self.create_order( |
Thanks for your answer! But how can I submit a limit order now? |
Lumibot changed the parameters apparently, type is not valid anymore. How to make a limit order or other types of orders (like a bracket order) can be found on their documentation https://lumibot.lumiwealth.com/entities.order.html#advanced-order-types. |
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
The text was updated successfully, but these errors were encountered: