Skip to content

feat(client): support perps TP/SL orders#153

Open
cesarenaldi wants to merge 1 commit into
mainfrom
feature/dev-334-support-perps-tpsl-in-the-typescript-sdk
Open

feat(client): support perps TP/SL orders#153
cesarenaldi wants to merge 1 commit into
mainfrom
feature/dev-334-support-perps-tpsl-in-the-typescript-sdk

Conversation

@cesarenaldi

@cesarenaldi cesarenaldi commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add Perps TP/SL order metadata parsing and lifecycle event handling.
  • Add Perps session helpers for bracket orders and full-position take-profit/stop-loss placement.
  • Add focused tests and a patch changeset.

Linear: https://linear.app/polymarket/issue/DEV-334/support-perps-tpsl-in-the-typescript-sdk

Verification

  • pnpm test:bindings -- --run packages/bindings/src/perps/orders.test.ts
  • pnpm --filter @polymarket/bindings build
  • pnpm test:client -- --run packages/client/src/websockets/perps/session.test.ts
  • pnpm --filter @polymarket/client build
  • pnpm lint
  • pnpm typecheck

Note

Medium Risk
Touches signed perps trading commands and extends createOrders wire format; mistakes could mis-place exits, but changes are additive with focused tests and ordinary orders stay on the existing path.

Overview
Adds Perps take-profit/stop-loss support across bindings and the session client: new PerpsTpSlKind / PerpsTpSlScope types, optional tpSl metadata on REST and websocket order payloads, and tpsl:: lifecycle events (untriggered, armed, cancelled, expired) merged into PerpsSessionEvent.

On the client, placeBracketOrder submits the entry leg plus optional TP/SL exits in one grouped createOrders (grp: 'order'), and placePositionTakeProfitStopLoss places full-position market triggers (grp: 'position'). Order encoding now supports reduce-only legs, optional tif, and tr trigger bodies (trp, tpsl, optional market). Sessions subscribe to tpsl alongside existing account channels.

Includes binding/client tests and patch changesets for @polymarket/client and @polymarket/bindings.

Reviewed by Cursor Bugbot for commit c898b8a. Bugbot is set up for automated code reviews on this repo. Configure here.

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