hummingbot / hummingbot/hummingbot-api

Bitget Perpetual - every order fails to submit when trading through hummingbot-api

Open
#201 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
142
Forks
194
Avg merge
3d 20h
Merged PRs (30d)
7

Description

Describe the bug

While running a grid_executor on bitget_perpetual through hummingbot-api, no order ever reached the exchange. The executor was created fine and the API answered 201 Created, but the logs then repeated "Failed to submit BUY order to Bitget_perpetual. Check API key and network connection." about once per second. The same API keys place orders normally in the Hummingbot client using the grid_strike V2 controller.

#### HAPI logs

INFO:     172.19.0.1:52146 - "POST /executors/ HTTP/1.1" 201 Created
03:25:31.051 POST /executors/search
INFO:     172.19.0.1:52146 - "POST /executors/search HTTP/1.1" 200 OK
03:25:31.058 GET /executors/positions/summary
INFO:     172.19.0.1:52146 - "GET /executors/positions/summary HTTP/1.1" 200 OK
2026-07-31 03:25:31,131 - hummingbot.connector.derivative.bitget_perpetual.bitget_perpetual_derivative.BitgetPerpetualDerivative - WARNING - Failed to submit BUY order to Bitget_perpetual. Check API key and network connection.
2026-07-31 03:25:32,138 - hummingbot.connector.derivative.bitget_perpetual.bitget_perpetual_derivative.BitgetPerpetualDerivative - WARNING - Failed to submit BUY order to Bitget_perpetual. Check API key and network connection.
2026-07-31 03:25:33,134 - hummingbot.connector.derivative.bitget_perpetual.bitget_perpetual_derivative.BitgetPerpetualDerivative - WARNING - Failed to submit BUY order to Bitget_perpetual. Check API key and network connection.
2026-07-31 03:25:34,121 - hummingbot.connector.derivative.bitget_perpetual.bitget_perpetual_derivative.BitgetPerpetualDerivative - WARNING - Failed to submit BUY order to Bitget_perpetual. Check API key and network connection.

The real reply from Bitget is not shown at the default log level, but the failed orders saved in the API database carry it: HTTP 400, code 40774, "The order type for unilateral position must also be the unilateral position type." The API reports HEDGE for this connector while the Bitget account is in one-way mode, so the orders go out with hedge-only fields and get rejected. Setting the connector back to ONEWAY through the position-mode route made orders go through immediately with nothing else changed, so the mode mismatch looks like the cause. That value resets whenever the connector is initialized again.

#### ask the API which position mode it is holding for the Bitget account
curl -s -u admin1:admin2 http://localhost:8000/trading/master_account/bitget_perpetual/position-mode | jq
{
  "position_mode": "HEDGE",
  "connector": "bitget_perpetual",
  "account": "master_account"
}

#### put the connector back to one-way so it matches the exchange account
curl -s -u admin1:admin2 -H 'Content-Type: application/json' -X POST http://localhost:8000/trading/master_account/bitget_perpetual/position-mode -d '{"position_mode":"ONEWAY"}' | jq
{
  "status": "success",
  "message": "Position mode set to ONEWAY on bitget_perpetual"
}

#### confirm the connector really holds one-way before retesting orders
curl -s -u admin1:admin2 http://localhost:8000/trading/master_account/bitget_perpetual/position-mode | jq
{
  "position_mode": "ONEWAY",
  "connector": "bitget_perpetual",
  "account": "master_account"
}

Screenshot from my condor webUI after i stopped the grid_executor ✅
Image

Steps to reproduce bug
  1. Make sure the Bitget futures account is in one-way (unilateral) position mode, which is the default
  2. Add the bitget_perpetual API keys to hummingbot-api and connect the account
  3. Create a grid_executor on bitget_perpetual through the hummingbot-api executors route
  4. Watch the logs for the repeated "Failed to submit BUY order to Bitget_perpetual" warning
  5. Check GET /trading/{account_name}/bitget_perpetual/position-mode and see HEDGE even though the account is one-way
  6. Read error_message on the FAILED bitget_perpetual rows in the orders table to see the 40774 reply

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the trading/{account_name}/bitget_perpetual/position-mode routes and trace how the connector's position mode is initialized and applied when orders are submitted. Reproduce with a one-way Bitget account, inspect the failed orders' error_message for code 40774, and verify that initialization preserves ONEWAY so grid_executor orders succeed without manually resetting the mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.