Hey <@&1485393752645173399> I'm working on aggregating PnL for my account using the Closed Positions and Open Positions endpoints, and I've run into a data discrepancy that's affecting my calculations.
Issue: Closed positions returning zero PnL
Recent calls to the closed-positions API are returning a realized_pnl of zero for all markets/positions. Similarly, in the Polymarket UI, all my recent trades are showing as losses with a PnL of zero — no winning markets are reflected, which I know to be incorrect.
The discrepancy in numbers:
Account PnL for yesterday (per the Polymarket UI/PnL graph): +$1,290
PnL I'm computing from stored data (DB dump of yesterday's positions):
cash_pnl from the Open Positions API
realized_pnl from the Closed Positions API
Combined total: -$1,455
Overall PnL from both APIs combined: ~$300, whereas the Polymarket UI shows ~$10,000
This suggests the realized_pnl field in the closed positions endpoint is not being populated correctly.
Endpoints used:
https://docs.polymarket.com/api-reference/core/get-closed-positions-for-a-user
https://docs.polymarket.com/api-reference/core/get-current-positions-for-a-user
Validation endpoint (all recent positions show PnL of zero):
https://data-api.polymarket.com/closed-positions?user=0xbd0f6c867e2a852807ef8fcdd76d696053da48fd&limit=500&offset=0&sortBy=TIMESTAMP&sortDirection=DESC
I've also attached screenshots for further validation.
Could you help clarify why realized_pnl is returning zero, and what the correct approach is to accurately calculate consolidated account PnL using your APIs?
Hey <@&1485393752645173399> I'm working on aggregating PnL for my account using the Closed Positions and Open Positions endpoints, and I've run into a data discrepancy that's affecting my calculations.
Issue: Closed positions returning zero PnL
Recent calls to the closed-positions API are returning a realized_pnl of zero for all markets/positions. Similarly, in the Polymarket UI, all my recent trades are showing as losses with a PnL of zero — no winning markets are reflected, which I know to be incorrect.
The discrepancy in numbers:
Account PnL for yesterday (per the Polymarket UI/PnL graph): +$1,290
PnL I'm computing from stored data (DB dump of yesterday's positions):
cash_pnl from the Open Positions API
realized_pnl from the Closed Positions API
Combined total: -$1,455
Overall PnL from both APIs combined: ~$300, whereas the Polymarket UI shows ~$10,000
This suggests the realized_pnl field in the closed positions endpoint is not being populated correctly.
Endpoints used:
https://docs.polymarket.com/api-reference/core/get-closed-positions-for-a-user
https://docs.polymarket.com/api-reference/core/get-current-positions-for-a-user
Validation endpoint (all recent positions show PnL of zero):
https://data-api.polymarket.com/closed-positions?user=0xbd0f6c867e2a852807ef8fcdd76d696053da48fd&limit=500&offset=0&sortBy=TIMESTAMP&sortDirection=DESC
I've also attached screenshots for further validation.
Could you help clarify why realized_pnl is returning zero, and what the correct approach is to accurately calculate consolidated account PnL using your APIs?
Hey <@&1485393752645173399> I'm working on aggregating PnL for my account using the Closed Positions and Open Positions endpoints, and I've run into a data discrepancy that's affecting my calculations.
Issue: Closed positions returning zero PnL
Recent calls to the closed-positions API are returning a realized_pnl of zero for all markets/positions. Similarly, in the Polymarket UI, all my recent trades are showing as losses with a PnL of zero — no winning markets are reflected, which I know to be incorrect.
The discrepancy in numbers:
Account PnL for yesterday (per the Polymarket UI/PnL graph): +$1,290
PnL I'm computing from stored data (DB dump of yesterday's positions):
cash_pnl from the Open Positions API
realized_pnl from the Closed Positions API
Combined total: -$1,455
Overall PnL from both APIs combined: ~$300, whereas the Polymarket UI shows ~$10,000
This suggests the realized_pnl field in the closed positions endpoint is not being populated correctly.
Endpoints used:
https://docs.polymarket.com/api-reference/core/get-closed-positions-for-a-user
https://docs.polymarket.com/api-reference/core/get-current-positions-for-a-user
Validation endpoint (all recent positions show PnL of zero):
https://data-api.polymarket.com/closed-positions?user=0xbd0f6c867e2a852807ef8fcdd76d696053da48fd&limit=500&offset=0&sortBy=TIMESTAMP&sortDirection=DESC
I've also attached screenshots for further validation.
Could you help clarify why realized_pnl is returning zero, and what the correct approach is to accurately calculate consolidated account PnL using your APIs?
Hey <@&1485393752645173399> I'm working on aggregating PnL for my account using the Closed Positions and Open Positions endpoints, and I've run into a data discrepancy that's affecting my calculations.
Issue: Closed positions returning zero PnL
Recent calls to the closed-positions API are returning a realized_pnl of zero for all markets/positions. Similarly, in the Polymarket UI, all my recent trades are showing as losses with a PnL of zero — no winning markets are reflected, which I know to be incorrect.
The discrepancy in numbers:
Account PnL for yesterday (per the Polymarket UI/PnL graph): +$1,290
PnL I'm computing from stored data (DB dump of yesterday's positions):
cash_pnl from the Open Positions API
realized_pnl from the Closed Positions API
Combined total: -$1,455
Overall PnL from both APIs combined: ~$300, whereas the Polymarket UI shows ~$10,000
This suggests the realized_pnl field in the closed positions endpoint is not being populated correctly.
Endpoints used:
https://docs.polymarket.com/api-reference/core/get-closed-positions-for-a-user
https://docs.polymarket.com/api-reference/core/get-current-positions-for-a-user
Validation endpoint (all recent positions show PnL of zero):
https://data-api.polymarket.com/closed-positions?user=0xbd0f6c867e2a852807ef8fcdd76d696053da48fd&limit=500&offset=0&sortBy=TIMESTAMP&sortDirection=DESC
I've also attached screenshots for further validation.
Could you help clarify why realized_pnl is returning zero, and what the correct approach is to accurately calculate consolidated account PnL using your APIs?
it's gross pnl
it's gross pnl
as for the rest i'm not sure
as for the rest i'm not sure