Skip to content

TypeScript SDK Position type missing currentValue field #1148

@realfishsam

Description

@realfishsam

Gap

The core Position type declares a currentValue field representing the current market value of the position (size × current price). The Python SDK's Position dataclass includes current_value. The TypeScript SDK's Position interface omits it entirely.

Core

File: core/src/types.ts

interface Position {
  marketId: string;
  outcomeId: string;
  outcomeLabel?: string | null;
  size: number;
  entryPrice?: number | null;
  currentPrice?: number | null;
  currentValue?: number | null;   // ← missing from TypeScript SDK
  unrealizedPnL?: number | null;
  realizedPnL?: number;
  txHash?: string | null;
  chain?: string | null;
  blockNumber?: number | null;
}

currentValue is populated by several exchange normalizers (e.g. Myriad, SuiBets, Rain) that return a pre-computed position value rather than requiring the client to multiply size × currentPrice.

TypeScript SDK

File: sdks/typescript/pmxt/models.ts, lines 344–377

export interface Position {
    marketId: string;
    outcomeId: string;
    outcomeLabel?: string;
    size: number;
    entryPrice?: number;
    currentPrice?: number;
    // currentValue is absent
    unrealizedPnL?: number;
    realizedPnL?: number;
    txHash?: string | null;
    chain?: string | null;
    blockNumber?: number | null;
}

currentValue is not present.

Python SDK

File: sdks/python/pmxt/models.py, lines 537–587

Python Position dataclass includes current_value: Optional[float] = None

Evidence

grep -n "currentValue" sdks/typescript/pmxt/models.ts returns zero results. core/src/types.ts explicitly declares currentValue?: number | null in the Position interface. The Python SDK's models.py confirms current_value: Optional[float] = None within the Position dataclass.

Impact

TypeScript users calling fetchPositions() cannot read the pre-computed currentValue for each position. For exchanges that return it (Myriad, SuiBets, Rain), the field is discarded by TypeScript's type system, forcing users to re-derive it as position.size * position.currentPrice — which may differ from the exchange's own calculation (e.g. if the exchange returns a value that accounts for fees or funding). The Python SDK already exposes this field correctly.


Found by automated Core-to-SDK surface coverage audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-sdk-gapCore engine capabilities not exposed in SDKs

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions