Skip to content

Both SDKs' hosted-mode fetchMyTrades ignores outcomeId/marketId/since/until/limit/cursor entirely — sibling fetchOpenOrders forwards its filter, fetchMyTrades forwards none #2194

Description

@realfishsam

Gap

fetchMyTrades(params?: MyTradesParams) is typed in both SDKs to accept outcomeId, marketId, since, until, limit, and cursor, and in venue-direct (non-hosted) mode the whole params object is forwarded to the sidecar. In hosted-trading mode, however, both SDKs' hosted branch calls the hosted /v0/user/{address}/trades route with no query parameters at all — every filter/pagination field silently vanishes. This is not a fundamental limitation of hosted mode: the sibling method fetchOpenOrders, right next to it in both files, does forward its one filter param (marketId) in its own hosted branch, showing the routing mechanism supports request params — fetchMyTrades just never wires any through.

Core

Core's MyTradesParams (core/src/exchanges/interfaces.ts:197-207) declares outcomeId, marketId, since, until, limit, cursor as the full filter surface for fetchMyTrades, and BaseExchange.fetchMyTrades (core/src/BaseExchange.ts:1237) accepts and is expected to honor all of them.

TypeScript SDK

  • sdks/typescript/pmxt/client.ts:1502-1511 — hosted branch of fetchMyTrades:
    if (this.isHosted) {
        const resolvedAddress = resolveWalletAddress(this, undefined);
        const route = HOSTED_METHOD_ROUTES.get("fetchMyTrades")!;
        const path = formatRoutePath(route, { address: resolvedAddress });
        const data = await _tradingRequest(this, { method: route.method, path });
        ...
    }
    No params object is read at all in this branch — the params?: MyTradesParams argument to the method is entirely unused when isHosted is true.
  • Compare sdks/typescript/pmxt/client.ts:1464-1477 (fetchOpenOrders), which in its own hosted branch builds const params: Record<string,string> = { address: resolvedAddress }; if (marketId !== undefined) params.market_id = marketId; and passes that params object into _tradingRequest(this, { method: route.method, path, params }) — proving the hosted request path supports query params when the caller wires them up.

Python SDK

  • sdks/python/pmxt/client.py:1712-1719 — hosted branch of fetch_my_trades:
    if self.is_hosted:
        resolved_address = resolve_wallet_address(self, None)
        response = self._hosted_request(
            "fetch_my_trades",
            path_params={"address": resolved_address},
        )
        return self._hosted_collection(response, "trades", user_trade_from_v0)
    Same gap — params/kwargs are never read in this branch.

Evidence

Read both hosted branches directly (client.ts:1502-1533, client.py:1712-1741) and compared against fetchOpenOrders's hosted branch in the same file (client.ts:1464-1477), which does forward its filter param the same way fetchMyTrades should. The non-hosted branches of fetchMyTrades in both SDKs forward the full params object correctly — the gap is isolated to the hosted-mode code path.

Impact

Any hosted-trading user (a pmxtApiKey-configured client, e.g. via Router or a venue class like Polymarket({pmxtApiKey: ...})) calling fetchMyTrades({ marketId, since, until, limit, cursor }) gets back the caller's entire hosted trade history with none of the requested filtering or pagination applied — silently wrong results rather than an error, with no way to page through a large trade history in hosted mode at all.


Found by automated Core-to-SDK surface coverage audit

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions