Skip to content

v0.1.3

Choose a tag to compare

@tibs245 tibs245 released this 05 Jun 15:07
· 9 commits to main since this release

Fixed

  • close_position rejected with validation.null-not-allowed.request.
    IG silently drops the body of real DELETE requests, so every
    required field on ClosePositionRequest was reported as null. The
    transport now mirrors the official Python trading-ig client and
    rewrites body-carrying DELETEs as POST with an _method: DELETE
    header. Bodyless DELETEs (session logout, watchlists delete,
    workingorders delete) are untouched. Validated live on a demo
    account: position fully closed, expected P/L confirmed.
  • Defence in depth: ClosePositionRequest now carries
    #[serde(skip_serializing_if = "Option::is_none")] on every optional
    field, so explicit nulls never reach IG even if a future code path
    bypasses the transport rewrite.

Added

  • examples/diag_close_position.rs — list open positions and close the
    first, logging the outbound JSON. Handy when reproducing the
    null-not-allowed bug or validating the rewrite against a fresh demo
    account.
  • tests/dealing_positions.rs::close_position_rewrites_delete_to_post_with_method_override
    pins the rewrite + asserts the JSON body survives intact.
  • tests/support/matchers::HasMethodOverride and
    IgMockServer::mount_delete_error helpers for tests that target
    body-carrying DELETE endpoints.