这是indexloc提供的服务,不要输入任何密码
Skip to content

Bug with binance_perpetual_testnet connector (and potential fix) #7842

@michaelcarter

Description

@michaelcarter

Describe the bug

When running a V2 strategy with the binance_perpetual_testnet connector, I was getting the following start_trade_monitor failed error:

2025-11-04 11:55:16,386 - 65774 - hummingbot.client.hummingbot_application - ERROR - start_trade_monitor failed.
Traceback (most recent call last):
  File "/Users/me/Developer/trading/hummingbot/hummingbot/client/ui/interface_utils.py", line 78, in start_trade_monitor
    cur_balances = await hb.trading_core.get_current_balances(market)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/Developer/trading/hummingbot/hummingbot/core/trading_core.py", line 723, in get_current_balances
    await self.connector_manager.update_connector_balances(connector_name)
  File "/Users/me/Developer/trading/hummingbot/hummingbot/core/connector_manager.py", line 203, in update_connector_balances
    raise ValueError(f"Connector {connector_name} not found")
ValueError: Connector binance_perpetual not found

The problem here is it’s looking for a binance_perpetual connector rather than binance_perpetual_testnet as it should be.

I think I’ve found the source of the issue, but I’m unsure whether my "fix" is correct. Here’s a summary of my investigation:

  1. I added some logging to interface_utils.py and noted the following:
if hb.trading_core._strategy_running and hb.trading_core.strategy is not None:

  # Here `hb.trading_core.markets` has the expected key: 'binance_perpetual_testnet'
  if all(market.ready for market in hb.trading_core.markets.values()):
    with hb.trading_core.trade_fill_db.get_new_session() as session:

      # But here each entry of `trades` has a market key with the incorrect name: 'binance_perpetual'
      trades: List[TradeFill] = hb._get_trades_from_session(
        int(hb.init_time * 1e3),
        session=session,
        config_file_path=hb.strategy_file_name)
      if len(trades) > 0:
        return_pcts = []
        pnls = []
        market_info: Set[Tuple[str, str]] = set((t.market, t.symbol) for t in trades)
        for market, symbol in market_info:
          cur_trades = [t for t in trades if t.market == market and t.symbol == symbol]
          cur_balances = await hb.trading_core.get_current_balances(market)
...
  1. I then followed the calls through to markets_recorder.py which is setting the market field to market.display_name.

  2. I then followed that to connector_base.pyx, which returns self.name

  3. I then looked in binance_perpetual_derivative.py and noted that name returns CONSTANTS.EXCHANGE_NAME which is "binance_perpetual".

  4. I updated this on my local copy of Hummingbot to instead return self._domain (the same way derive_perpetual.py does):

@property
def name(self) -> str:
  return self._domain # Changed from CONSTANTS.EXCHANGE_NAME

This fixed my issue 🎉, but I’m very new to Hummingbot, and so I’m unsure if this is the correct fix.

Steps to reproduce

As far as I can tell it’s as simple as running a V2 strategy with the binance_perpetual_testnet connector. I encountered the issue while writing a custom controller which I can’t share here, but it seems like a general issue.

I initially encountered the issue using hummingbot-deploy, and confirmed it on the source installation.

Release version

2.10.0

Type of installation

Source

Attach required files

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions