Skip to content

fix(typescript): add currentValue to Position model and hosted mapper - #2631

Open
ibrhmyi wants to merge 5 commits into
pmxt-dev:mainfrom
ibrhmyi:contributor/issue-2619-82bd8bfa19
Open

ibrhmyi wants to merge 5 commits into
pmxt-dev:mainfrom
ibrhmyi:contributor/issue-2619-82bd8bfa19

Conversation

@ibrhmyi

@ibrhmyi ibrhmyi commented Oct 31, 2026

Copy link
Copy Markdown

Closes #2619.

Core's Position carries currentValue (size * currentPrice) and the Python SDK models and maps it — but the TypeScript SDK's Position interface lacks the field and the hosted-mode positionFromV0 mapper drops it. TypeScript users get a compile error accessing position.currentValue, and in hosted mode they never receive the value at all (the hosted docs even show position.currentValue in TypeScript examples that do not type-check).

Change

  • sdks/typescript/pmxt/models.ts — Position gains currentValue?: number | null with a doc comment in the file's style
  • sdks/typescript/pmxt/hosted-mappers.ts — positionFromV0 maps current_value/currentValue from the hosted payload (absent -> undefined, nothing fabricated)

Tests

  • New tests/hosted-mappers.test.ts (3 tests): snake_case mapping, absent field -> undefined, camelCase payload. RED on unmodified code was the exact user-facing failure: TS2339: Property 'currentValue' does not exist on type 'Position'.
  • Full TS SDK suite: 96/96 tests pass; tsc --noEmit clean

One out-of-scope note: the reverse mapper positionToV0 still omits currentValue (round-trip drops it) — happy to follow up if you want that direction covered too.

AI assistance was used for this contribution (implementation and review).

This branch has not been deployed

No deployments
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.

TypeScript SDK Position type and hosted positionFromV0 omit currentValue — core and Python SDK both carry it

1 participant