Skip to content

fix: trade search Gateway endpoint#86

Open
rupurt wants to merge 1 commit into
TexasCoding:mainfrom
rupurt:codex/fix-trade-search-endpoint
Open

fix: trade search Gateway endpoint#86
rupurt wants to merge 1 commit into
TexasCoding:mainfrom
rupurt:codex/fix-trade-search-endpoint

Conversation

@rupurt

@rupurt rupurt commented Jun 26, 2026

Copy link
Copy Markdown

Summary

Updates ProjectX.search_trades() to use the ProjectX Gateway trade search endpoint and request shape.

Root Cause

The SDK was calling GET /trades/search with query parameters. The Gateway API exposes trade history at POST /Trade/search with accountId, startTimestamp, and endTimestamp in the request body.

Changes

  • Calls POST /Trade/search from search_trades().
  • Sends Gateway timestamp fields in the request body.
  • Parses the Gateway { success, trades } response shape while preserving support for list responses.
  • Applies the existing limit argument client-side.
  • Updates client trading tests and fixtures for the corrected endpoint and payload.

Scope

This PR is endpoint and request-shape only. It does not change trade model fields or position response handling.

Related PRs:

Validation

  • uv run ruff check src/project_x_py/client/trading.py tests/conftest.py tests/client/test_trading.py tests/client/test_trading_legacy.py
  • uv run pytest tests/client/test_trading.py tests/client/test_trading_legacy.py

@rupurt rupurt changed the title [codex] Fix trade search Gateway endpoint Fix trade search Gateway endpoint Jun 26, 2026
@rupurt rupurt marked this pull request as ready for review June 26, 2026 06:55
- /trades/search -> /Trade/search
@rupurt rupurt force-pushed the codex/fix-trade-search-endpoint branch from 828b6d1 to 20eed09 Compare June 26, 2026 16:58
@rupurt rupurt changed the title Fix trade search Gateway endpoint fix: trade search Gateway endpoint Jun 26, 2026
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