Skip to content

Support TPSL order type#81

Merged
alexex10 merged 4 commits intostarknetfrom
feature/support-tpsl-order-type
Mar 18, 2026
Merged

Support TPSL order type#81
alexex10 merged 4 commits intostarknetfrom
feature/support-tpsl-order-type

Conversation

@alexex10
Copy link
Contributor

@alexex10 alexex10 commented Mar 17, 2026

Changes

New:

  • Support TPSL order type (POSITION / ORDER) via order_type=OrderType.TPSL (see create_partial_tpsl_order and create_position_tpsl_order examples)

💥 Breaking:

  • create_order_object now accepts names args only, in the next PRs order object creation process will be reworked to be more user friendly (builder pattern)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for TPSL (Take Profit / Stop Loss) order type and makes create_order_object keyword-only.

Changes:

  • Added OrderType.TPSL support in create_order_object with validation rules for TPSL-specific constraints
  • Made create_order_object accept keyword-only arguments (breaking change), bumping version to 0.1.0
  • Added cancelled_qty field and made price optional on OpenOrderModel to accommodate TPSL orders

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
x10/perpetual/order_object.py Core TPSL order creation logic, keyword-only args, settlement/side handling
x10/perpetual/orders.py Made price optional, added cancelled_qty, added docstring
tests/perpetual/test_order_object.py Tests for partial and position TPSL order creation
pyproject.toml Version bump to 0.1.0
examples/create_position_tpsl_order.py New example for position TPSL orders
examples/create_partial_tpsl_order.py New example for partial TPSL orders
examples/placed_order_example_advanced.py Updated to use keyword args

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

ex10ded
ex10ded previously approved these changes Mar 17, 2026
Copy link
Contributor

@ex10ded ex10ded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will need to bump major version here

@alexex10
Copy link
Contributor Author

we will need to bump major version here

agree, bumped minor 🤦

@alexex10 alexex10 requested a review from ex10ded March 17, 2026 13:39
@alexex10 alexex10 merged commit e203784 into starknet Mar 18, 2026
7 checks passed
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.

3 participants