Summary
The Polymarket US adapter returns unrealizedPnl: 0 as a hardcoded constant for all positions. The polymarket-us SDK provides a cashValue field on position objects that represents the current mark-to-market value, from which unrealized PnL can be computed. This data is available but not mapped.
Impact
MEDIUM — all Polymarket US positions show zero unrealized P&L in PMXT, making the account view misleading for active positions.
Details
- Hardcoded value:
unrealizedPnl: 0 in core/src/exchanges/polymarket_us/index.ts
- Available data:
position.cashValue from the polymarket-us SDK — the mark-to-market value of the position
- Unrealized PnL calculation:
cashValue - (avgPrice * size) or as directly provided by the SDK if it exposes a unrealizedPnl field
- Check the
polymarket-us npm package for whether it exposes unrealizedPnl directly or only cashValue
Required Fix
- Check the
polymarket-us SDK position object for an unrealizedPnl or equivalent field
- If available directly, map it instead of hardcoding 0
- If not directly available, compute from
cashValue and position cost basis (avgPrice * size)
- Remove the hardcoded
unrealizedPnl: 0
Summary
The Polymarket US adapter returns
unrealizedPnl: 0as a hardcoded constant for all positions. Thepolymarket-usSDK provides acashValuefield on position objects that represents the current mark-to-market value, from which unrealized PnL can be computed. This data is available but not mapped.Impact
MEDIUM — all Polymarket US positions show zero unrealized P&L in PMXT, making the account view misleading for active positions.
Details
unrealizedPnl: 0incore/src/exchanges/polymarket_us/index.tsposition.cashValuefrom thepolymarket-usSDK — the mark-to-market value of the positioncashValue - (avgPrice * size)or as directly provided by the SDK if it exposes aunrealizedPnlfieldpolymarket-usnpm package for whether it exposesunrealizedPnldirectly or onlycashValueRequired Fix
polymarket-usSDK position object for anunrealizedPnlor equivalent fieldcashValueand position cost basis (avgPrice * size)unrealizedPnl: 0