Skip to content

fix(ws): expose trigger fields on BasicOrder - #196

Open
DorianHsia wants to merge 1 commit into
hyperliquid-dex:masterfrom
DorianHsia:fix/ws-basic-order-trigger-fields
Open

fix(ws): expose trigger fields on BasicOrder#196
DorianHsia wants to merge 1 commit into
hyperliquid-dex:masterfrom
DorianHsia:fix/ws-basic-order-trigger-fields

Conversation

@DorianHsia

Copy link
Copy Markdown

Problem

WebSocket BasicOrder (used by orderUpdates) was missing fields that REST BasicOrderInfo already has. Live payloads include them; serde dropped them, so clients could not tell stop-loss / take-profit from a regular limit without polling REST.

Closes #192.

Change

Add to ws::BasicOrder, matching REST types (tif is Option<String> because stop-market sends null):

  • trigger_condition, is_trigger, trigger_px
  • is_position_tpsl, reduce_only, order_type, tif

New fields use #[serde(default)] so incomplete/legacy fixtures still deserialize.

Tests

  • limit OrderUpdate with isTrigger: false, tif: "Gtc"
  • stop-market BasicOrder with isTrigger: true, tif: null
  • legacy payload without the new fields still parses

cargo test --lib -- ws::sub_structs

Made with Cursor

orderUpdates payloads already include isTrigger, triggerPx, reduceOnly,
and related fields, but WebSocket BasicOrder dropped them so TP/SL could
not be identified without polling REST. Align the struct with REST
BasicOrderInfo, keep serde defaults for older payloads, and add
deserialize tests. Fixes hyperliquid-dex#192.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

WebSocket BasicOrder missing trigger fields present in REST BasicOrderInfo

1 participant