Skip to content

fix(clob): add side field to MakerOrder struct#14

Open
jclmnop wants to merge 1 commit intoPolymarket:mainfrom
jclmnop:fix/trade-event-maker-order-side
Open

fix(clob): add side field to MakerOrder struct#14
jclmnop wants to merge 1 commit intoPolymarket:mainfrom
jclmnop:fix/trade-event-maker-order-side

Conversation

@jclmnop
Copy link
Copy Markdown

@jclmnop jclmnop commented Apr 25, 2026

Each trade event contains a list of maker orders. These orders can have different side values (BUY/SELL) that aren't just the opposite of the taker order.

The maker orders in the websocket event have a side field, but it's been missed in the clob client so it's not deserialized.

If using trade events to calculate changes in your own positions, it's helpful to be able to tell whether your maker order in the trade event was a BUY or SELL order.

Fixed by adding the field to the MakerOrder struct


Been using this fix in the v1 sdk for a while now with no issues. I'm assuming it will be the same for the v2 client. Forgot to ever open a PR in the old repo because it's such a tiny fix.

By this point I must have deserialised tens of thousands of trade events, and never had any errors (or Side::Unknown(_) variants).


Note

Low Risk
Low risk: adds a missing side field to WebSocket trade maker-order deserialization and updates the corresponding test fixture; no behavior changes beyond exposing additional parsed data.

Overview
Trade WebSocket parsing now includes the maker order’s side by adding a side: Side field to MakerOrder in src/clob/ws/types/response.rs.

The WebSocket integration test payload in tests/websocket.rs is updated to include "side": "BUY" in maker_orders, ensuring deserialization coverage for the new field.

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

Each trade event contains a list of maker orders. These orders can have
different `side` values to the taker order.

The maker orders in the websocket event have a `side` field, but it's
been missed in the clob client so it's not deserialized.

Fixed by adding the field to the `MakerOrder` struct
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