Rename position_deal to lifecycle to conform with grid ladders convention#1064
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the KuCoin futures “PositionDeal” implementation and call sites to use the exchange_apis.kucoin.futures.lifecycle module name (instead of position_deal), aligning naming with the grid ladders lifecycle convention, while also introducing new trailing-stop reconciliation/cooldown behavior in the KuCoin futures lifecycle.
Changes:
- Renamed/retargeted imports and monkeypatch paths from
exchange_apis.kucoin.futures.position_dealtoexchange_apis.kucoin.futures.lifecycle. - Added trailing-stop replace cooldown logic and tightened stop-order handling (track trailing order id, selectively cancel trailing stop, filter exchange stop queries by order id).
- Expanded test coverage around trailing-stop reconciliation, cooldown gating, and “tracked trailing order” behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| api/exchange_apis/kucoin/futures/lifecycle.py | Adds trailing-stop cooldown and “tracked trailing stop” reconciliation/placement behavior; updates class framing to “lifecycle”. |
| api/exchange_apis/kucoin/futures/futures_deal.py | Adds shared stop-order utilities (terminal statuses, tracked stop lookup, selective trailing cancel, exchange stop query by order id, configurable cooldown). |
| api/tests/test_kucoin_futures_stop_loss.py | Updates imports/monkeypatch targets and adds multiple regression tests for trailing-stop tracking/cooldown behavior. |
| api/tests/test_futures_reversal_integration.py | Updates PositionDeal import and monkeypatch target to the new module path. |
| api/tests/test_bot_model_defaults.py | Updates PositionDeal import path. |
| api/tests/test_anti_wick_exit.py | Updates PositionDeal import path. |
| api/deals/gateway.py | Updates PositionDeal import path used by deal routing. |
| api/bots/routes.py | Updates PositionDeal import path used by bot routes. |
Comments suppressed due to low confidence (1)
api/exchange_apis/kucoin/futures/lifecycle.py:48
- The PR description/title focuses on renaming
position_deal→lifecycle, but this diff also introduces new trailing-stop replacement behavior (cooldown + selective cancellation + new reconciliation rules). Please update the PR description (or split into a separate PR) so reviewers/operators can evaluate the behavioral change explicitly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Closes #1058