> For the complete documentation index, see [llms.txt](https://docs.radfi.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.radfi.co/dev/api-endpoints/pnl.md).

# Pnl

## Get PnL position for a trading address and token

> Returns the materialized cost basis position for chart overlay.\
> \
> \- source: amm | sodax\
> \- avgCostBasis: USD per display token unit\
> \- totalQty: remaining display token quantity\
> \- Returns zeroed fields when no position exists.

```json
{"openapi":"3.0.0","info":{"title":"Radfi API","version":"1.0"},"servers":[{"url":"https://api.radfi.co","description":"Production"}],"paths":{"/api/pnl/position":{"get":{"operationId":"PnlController_getPosition","summary":"Get PnL position for a trading address and token","description":"Returns the materialized cost basis position for chart overlay.\n\n- source: amm | sodax\n- avgCostBasis: USD per display token unit\n- totalQty: remaining display token quantity\n- Returns zeroed fields when no position exists.","parameters":[{"name":"source","required":true,"in":"query","schema":{"enum":["amm","sodax"],"type":"string"}},{"name":"tokenId","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["pnl"]}}}}
```

## Get PnL balances for a trading address

> Returns all non-zero positions with live unrealized PnL for the Balances tab.\
> \
> \- AMM and SODAX positions are returned as separate items (source field).\
> \- unrealizedPnl = (currentPrice − avgCostBasis) × totalQty (USD)\
> \- Fully closed positions (totalQty = 0) are excluded.

```json
{"openapi":"3.0.0","info":{"title":"Radfi API","version":"1.0"},"servers":[{"url":"https://api.radfi.co","description":"Production"}],"paths":{"/api/pnl/balances":{"get":{"operationId":"PnlController_getPnlBalances","summary":"Get PnL balances for a trading address","description":"Returns all non-zero positions with live unrealized PnL for the Balances tab.\n\n- AMM and SODAX positions are returned as separate items (source field).\n- unrealizedPnl = (currentPrice − avgCostBasis) × totalQty (USD)\n- Fully closed positions (totalQty = 0) are excluded.","parameters":[],"responses":{"200":{"description":""}},"tags":["pnl"]}}}}
```
