Skip to content

fix: add info field to Balance and Position types#593

Closed
realfishsam wants to merge 1 commit into
mainfrom
fix/459-balance-position-info
Closed

fix: add info field to Balance and Position types#593
realfishsam wants to merge 1 commit into
mainfrom
fix/459-balance-position-info

Conversation

@realfishsam
Copy link
Copy Markdown
Contributor

Fixes #459

@realfishsam
Copy link
Copy Markdown
Contributor Author

PR Review: FAIL

What This Does

Adds an info: any field to the Position and Balance interfaces in types.ts, and populates it with the raw exchange response in 6 exchange normalizers: Hyperliquid, Kalshi, Limitless, Myriad, Polymarket, and Smarkets.

Blast Radius

  • core/src/types.ts -- core type definitions (all consumers affected)
  • 6 exchange normalizers updated
  • OpenAPI schema (AST-derived, will auto-propagate on regeneration)
  • Python SDK models.py (needs manual update -- not done)
  • TypeScript SDK client.ts (pass-through via spread, will work)

Findings

  1. CRITICAL: 5 exchanges missing info field: The Position interface now requires info (non-optional), but the following normalizers do NOT set it:

    • gemini-titan/normalizer.ts (normalizePosition)
    • probable/normalizer.ts (normalizePosition)
    • opinion/normalizer.ts (normalizePosition)
    • polymarket_us/normalizer.ts (normalizePositions, normalizeBalance)
    • baozi/normalizer.ts (normalizeBalance)

    Since info is a required field (no ?), TypeScript compilation will fail for these exchanges. This is a build-breaking change.

  2. CRITICAL: Myriad normalizePosition not updated: The diff shows info: rawItems added to normalizeBalance in Myriad, but normalizePosition at line 228 is not updated. The Myriad position normalizer will also fail to compile.

  3. Python SDK models.py not updated: The Position and Balance dataclasses in sdks/python/pmxt/models.py do not have an info field. The _auto_convert function will silently drop the field (or fail depending on strictness). The info field should be added to both Python dataclasses as info: Any = None.

  4. OpenAPI spec not regenerated: While the schema is now AST-derived from types.ts, the PR does not include a regenerated openapi.yaml. CI will likely fail the OpenAPI sync check.

  5. info: any weakens type safety: Using any is the pragmatic choice for raw exchange data, but it means consumers get no type checking on the field. Consider info: unknown or info: Record<string, unknown> for slightly better safety, though any is consistent with how info is used in CCXT.

PMXT Pipeline Check

  • Field propagation: ISSUE (5+ exchange normalizers and Python SDK missing the field)
  • OpenAPI sync: ISSUE (spec not regenerated)
  • Type safety: ISSUE (required field not set in all implementations)

Semver Impact

minor -- adds a new field to public types (Position, Balance). Would be major if info stays required and breaks existing code that constructs these types.

Risk

This PR will not compile. All exchanges with normalizePosition or normalizeBalance must be updated before merge.

@realfishsam realfishsam deleted the fix/459-balance-position-info branch May 24, 2026 17:06
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.

Balance and Position missing required info: any field that CCXT mandates on all structural types

1 participant