Skip to content

fix(trading): a refused order, a lost tracker, and a stale balance are not success - #258

Open
carlito-hummingbot wants to merge 1 commit into
hummingbot:mainfrom
carlito-hummingbot:combine/trading-api-truth
Open

carlito-hummingbot wants to merge 1 commit into
hummingbot:mainfrom
carlito-hummingbot:combine/trading-api-truth

Conversation

@carlito-hummingbot

Copy link
Copy Markdown

Summary

One PR for the three hummingbot-api fixes, which otherwise conflict on services/accounts_service.py.

#334 is not involved. This does not touch Condor.

Test plan

  • test_cancel_by_exchange_id.py test_place_order_refusal.py test_stop_and_archive_bot_name.py — 19 passed
  • isort (5.12.0, pyproject) and flake8 (130) clean on the touched files

…e not success

Three fixes that share the trading path, combined so they land once:

- cancel an order by the venue's own id when the in-flight tracker no longer
  holds it (the order is still live at the venue)
- a venue refusal is not a 201: place_trade waits for the submission result
- refresh account balances after a bot is archived, as a second ordered
  background task, so the archive call itself is unchanged

Supersedes hummingbot-api hummingbot#252, hummingbot#255 and hummingbot#257.

Tests: 19 passed (test_cancel_by_exchange_id, test_place_order_refusal,
test_stop_and_archive_bot_name). isort and flake8 clean.
@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; no actionable issues were established.

Summary

This PR adds cancellation by exchange order ID, checks order submission results before responding, and refreshes exchange balances after archiving a bot.

  • Traders can cancel live orders with the venue's order ID.
  • Order placement reports venue refusals instead of a successful submission.
  • Bot archives refresh account balances after the archive task finishes.

No actionable issues were established.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Trading request] --> B{Operation}
    B -->|Place order| C[Call connector buy or sell]
    C --> D[Wait for submission result]
    D -->|Failed| E[Return 502]
    D -->|Accepted or timeout| F[Return order ID]
    B -->|Cancel by exchange ID| G{Order tracked?}
    G -->|Yes| H[Schedule cancel: initiated]
    G -->|No| I[Call venue cancel: submitted]
    J[Stop and archive request] --> K[Await archive task]
    K --> L[Refresh exchange balances]
Loading

Reviews (1) · Last reviewed commit: "fix(trading): a refused order, a lost tr..." · Reviewed by Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant