fix: drop unexpected market_type kwarg at LiveOrderPhaseAdapter call site - #228
Open
z20251130 wants to merge 1 commit into
Open
fix: drop unexpected market_type kwarg at LiveOrderPhaseAdapter call site#228z20251130 wants to merge 1 commit into
z20251130 wants to merge 1 commit into
Conversation
…site d169c03 added market_type= to the LiveOrderPhaseAdapter(...) call in the pending-order execution phase, but LiveOrderPhaseAdapter.__init__ never accepted it. Every strategy-generated live auto-order (all exchanges, spot and swap) therefore crashed with TypeError at final placement and was marked failed: Unexpected order error (binance BNB/USDT open_long): LiveOrderPhaseAdapter.__init__() got an unexpected keyword argument 'market_type' The adapter takes market_type from the OrderIntent in every method (place_market_order / place_limit_order / cancel_order / wait_for_fill); the kwarg was unused. Remove it from the call site. Reproduced on v5.0.1-beta (commit 21f1fb6) with the exact worker kwargs; no test covered this call site (test_live_exchange_fees.py constructs the adapter without the kwarg).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Strategy-generated live orders crash at final placement with
TypeError: LiveOrderPhaseAdapter.__init__() got an unexpected keyword argument 'market_type', so every live auto-order (all exchanges, spot and swap) has failed since d169c03 (2026-08-27). The commit addedmarket_type=to theLiveOrderPhaseAdapter(...)call, but the class never accepted that parameter. This PR removes the stray kwarg.Root cause
pending_order_worker.pybut not the adapter class (live_trading/adapters.py, last changed 2026-07-22).market_typefrom theOrderIntentin every method (place_market_order/place_limit_order/cancel_order/wait_for_fill), so the kwarg was not only unexpected but also unused — removing it from the call site is behavior-preserving.test_live_exchange_fees.pyconstructs the adapter without the kwarg), and the failure path is only reachable through live auto-trading, which is why it went unnoticed.Observed in production logs:
Changes
backend_api_python/app/services/pending_order_worker.py: remove the single unexpectedmarket_type=market_type,line from theLiveOrderPhaseAdapter(...)call. 1 line, nothing else.Test plan
python -m py_compile backend_api_python/app/services/pending_order_worker.py21f1fb6with the exact worker kwargs; confirmed the adapter constructs cleanly after removing the kwargAPI documentation
Backward compatibility