Skip to content

Initial unit tests for Order Cancel - #21

Merged
sonirico merged 1 commit into
sonirico:masterfrom
terwey:tests/exchange-orders-cancel
Aug 14, 2025
Merged

Initial unit tests for Order Cancel#21
sonirico merged 1 commit into
sonirico:masterfrom
terwey:tests/exchange-orders-cancel

Conversation

@terwey

@terwey terwey commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

fix(cancel): use int64 OrderID and surface first cancel error

  • Change CancelOrderWire.OrderID from string to int64 and stop stringifying OIDs in BulkCancel.
  • Add MixedArray.FirstError() to parse cancel responses and return the first error (if any).
  • Improve cancel error handling: check res.Ok/res.Status, return API err or first status error.
  • Tests: add TestMixedArray_FirstError and end-to-end cancel tests (resting order cancel, double-cancel error, non-existent OID).

Note: this depends on #20

This exposed quite a few bugs deep inside the SDK, the worst one was #20 which was a massive headache to chase. I do think adding more of these E2E tests are the way forward as they reflect the CURRENT reality and we're not just reverse engineering the Python SDK.

I'll add Cancel by CLOID tests later

* Change `CancelOrderWire.OrderID` from `string` to `int64` and stop stringifying OIDs in `BulkCancel`.
* Add `MixedArray.FirstError()` to parse cancel responses and return the first error (if any).
* Improve cancel error handling: check `res.Ok`/`res.Status`, return API `err` or first status error.
* Tests: add `TestMixedArray_FirstError` and end-to-end cancel tests (resting order cancel, double-cancel error, non-existent OID).
@sonirico
sonirico merged commit 00d7290 into sonirico:master Aug 14, 2025
1 of 4 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.

2 participants