-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Describe the bug
After the strategy runs for a longer time, a signal reversal occurs, and the following error will appear.
"Unhandled error in background task: unsupported operand type(s) for *: 'decimal.Decimal' and 'NoneType'"
Steps to reproduce
install scikit-learn reference to:
#7617
- Open hummingbot
- create stat_arb controller, modify the controller file (test on binance_perpetual and okx_perpetual)
- create script
- run the script
Release version
2.6.0
Type of installation
Source
Attach required files
TypeError: unsupported operand type(s) for *: 'decimal.Decimal' and 'NoneType'
2025-06-11 18:22:44,827 - 46925 - hummingbot.core.utils.async_utils - ERROR - Unhandled error in background task: unsupported operand type(s) for *: 'decimal.Decimal' and 'NoneType'
Traceback (most recent call last):
File "/home/user/hb2.6/hummingbot/hummingbot/core/utils/async_utils.py", line 9, in safe_wrapper
return await c
^^^^^^^
File "/home/user/hb2.6/hummingbot/hummingbot/strategy_v2/runnable_base.py", line 66, in control_loop
await self.on_start()
File "/home/user/hb2.6/hummingbot/hummingbot/strategy_v2/executors/executor_base.py", line 177, in on_start
await self.validate_sufficient_balance()
File "/home/user/hb2.6/hummingbot/hummingbot/strategy_v2/executors/order_executor/order_executor.py", line 311, in validate_sufficient_balance
adjusted_order_candidates = self.adjust_order_candidates(self.config.connector_name, [order_candidate])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/hb2.6/hummingbot/hummingbot/strategy_v2/executors/executor_base.py", line 266, in adjust_order_candidates
return self.connectors[exchange].budget_checker.adjust_candidates(order_candidates)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/hb2.6/hummingbot/hummingbot/connector/budget_checker.py", line 54, in adjust_candidates
self.adjust_candidate_and_lock_available_collateral(order_candidate, all_or_none)
File "/home/user/hb2.6/hummingbot/hummingbot/connector/budget_checker.py", line 78, in adjust_candidate_and_lock_available_collateral
adjusted_candidate = self.adjust_candidate(order_candidate, all_or_none)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/hb2.6/hummingbot/hummingbot/connector/budget_checker.py", line 97, in adjust_candidate
order_candidate = self.populate_collateral_entries(order_candidate)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/hb2.6/hummingbot/hummingbot/connector/budget_checker.py", line 119, in populate_collateral_entries
order_candidate.populate_collateral_entries(self._exchange)
File "/home/user/hb2.6/hummingbot/hummingbot/core/data_type/order_candidate.py", line 74, in populate_collateral_entries
self._populate_order_collateral_entry(exchange)
File "/home/user/hb2.6/hummingbot/hummingbot/core/data_type/order_candidate.py", line 93, in _populate_order_collateral_entry
oc_amount = self._get_order_collateral_amount(exchange, oc_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/hb2.6/hummingbot/hummingbot/core/data_type/order_candidate.py", line 288, in _get_order_collateral_amount
oc_amount = self._get_collateral_amount(exchange)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/hb2.6/hummingbot/hummingbot/core/data_type/order_candidate.py", line 328, in _get_collateral_amount
size_token, order_size = self.get_size_token_and_order_size()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/hb2.6/hummingbot/hummingbot/core/data_type/order_candidate.py", line 63, in get_size_token_and_order_size
order_size = self.amount * self.price
~~~~~~~~~~~~^~~~~~~~~~~~