> For the complete documentation index, see [llms.txt](https://docs.sodex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sodex.com/for-developers/api-reference/wealth-api/positions.md).

# Positions and PnL

Read what a wallet holds, what it has paid and not yet received, and how much it has earned. These routes always cover every fund for the address.

An empty wallet returns an empty list and zeros.

## Positions

`GET /users/{address}/positions`

Holdings, cost, and in-flight value across every fund. Vault funds and order-book funds are returned in one list. Share amounts follow on-chain balances, at full precision. The 6-decimal display truncation used by [User Fund History](https://docs.sodex.com/for-developers/api-reference/wealth-api/user-fund-history.md) does not apply here.

```bash
curl "https://mainnet-gw.sodex.dev/api/v1/wealth/users/0x1111111111111111111111111111111111111111/positions" \
  -H "Accept: application/json"
```

| Name      | Location | Type   | Required | Description       |
| --------- | -------- | ------ | -------- | ----------------- |
| `address` | path     | string | Yes      | User EVM address. |

| Field          | Type             | Description                                                |
| -------------- | ---------------- | ---------------------------------------------------------- |
| `address`      | string           | Wallet address.                                            |
| `asOfBlock`    | integer          | Block of the balance snapshot.                             |
| `summary`      | object           | Cross-fund in-flight total. It has no cost-basis sum.      |
| `positions`    | array            | One row per fund.                                          |
| `predeposit`   | object, optional | Predeposit sync state: `status`, `asOfBlock`, `updatedAt`. |
| `bridgeStatus` | string, optional | `ready`, `partial`, or `unavailable`.                      |

`summary.processingCost` and `summary.pendingProceeds` are the cross-fund in-flight totals. `summary.predepositAssets` is the predeposit asset amount. `summary.incomplete` is true when the snapshot is incomplete.

| Position field         | Type             | Description                                                                                     |
| ---------------------- | ---------------- | ----------------------------------------------------------------------------------------------- |
| `fundId`               | string           | Fund identifier.                                                                                |
| `name`                 | string, optional | Display name.                                                                                   |
| `iconUrl`              | string, optional | Icon URL.                                                                                       |
| `source`               | string           | `vault`, `clob`, or `bridge`.                                                                   |
| `vaultAddress`         | string, optional | Vault address.                                                                                  |
| `coin`                 | string, optional | Share coin.                                                                                     |
| `share`                | object, optional | Share token: `coin`, `address`, `decimals`.                                                     |
| `spot`                 | object, optional | CLOB pair.                                                                                      |
| `pendingRedeemShares`  | string           | Shares in an open redemption.                                                                   |
| `pendingDepositShares` | string           | Shares from an open deposit.                                                                    |
| `processingCost`       | string           | Cost still processing.                                                                          |
| `pendingProceeds`      | string           | Proceeds not yet received.                                                                      |
| `costBasis`            | string           | Cost basis.                                                                                     |
| `ledgerShares`         | string           | Ledger share count.                                                                             |
| `evmShares`            | string, optional | Shares on the EVM balance.                                                                      |
| `spotShares`           | string, optional | Shares on the spot balance.                                                                     |
| `perpShares`           | string, optional | Shares on the perp balance.                                                                     |
| `subscribeShares`      | string           | Shares from subscription.                                                                       |
| `avgCost`              | string, optional | Average cost.                                                                                   |
| `avgCostWithAirdrop`   | string, optional | Average cost including airdrops.                                                                |
| `completedCost`        | string           | Cost of completed entries.                                                                      |
| `redeemedShares`       | string           | Shares already redeemed.                                                                        |
| `asset`                | object           | Underlying asset. `decimals` is required. Vault rows carry `address`. CLOB rows carry `symbol`. |
| `bridge`               | object, optional | Bridged valuation and status.                                                                   |

`bridge` carries `sourceChainId`, `asOfBlock`, `blockHash`, and the status fields below, plus `price`, `priceAsOf`, `marketValue`, `realizedPnl`, `unrealizedPnl`, `pendingUnrealizedPnl`, `totalPnl`, `inFlightValue`, `pnl24h`, and `price24hAgo`. `venueReconciliation` is a diagnostic object forwarded without a defined field list.

| Bridge status   | Values                                                                 |
| --------------- | ---------------------------------------------------------------------- |
| `balanceStatus` | `complete`, `evm_only`, `unavailable`                                  |
| `pendingStatus` | `source_evidence_verified`, `unavailable`                              |
| `costStatus`    | `ready`. Any other value is incomplete.                                |
| `priceStatus`   | `ready`, `nav_unavailable`, `nav_stale`, `nav_invalid`, `not_required` |

## In-flight value

`GET /users/{address}/in-flight`

Money and shares a wallet has already paid, across every fund, and has not yet received. This is what is still outstanding.

```bash
curl "https://mainnet-gw.sodex.dev/api/v1/wealth/users/0x1111111111111111111111111111111111111111/in-flight" \
  -H "Accept: application/json"
```

Before pricing, value is counted on the side the user handed over. After pricing, it is counted on the side the chain already owes the user.

| Field          | Type             | Description                                         |
| -------------- | ---------------- | --------------------------------------------------- |
| `address`      | string           | Wallet address.                                     |
| `funds`        | array            | One object per fund that still has in-flight value. |
| `bridgeStatus` | string, optional | `ready`, `partial`, or `unavailable`.               |

Each fund has `fundId`, `nav`, and `inFlight`. `nav` is reserved and is currently always empty. `inFlight` lists the non-zero cells. Zero cells are omitted.

| Bucket field | Type    | Description                                                                                   |
| ------------ | ------- | --------------------------------------------------------------------------------------------- |
| `kind`       | string  | `subscribe`, `airdrop`, `deposit`, `redeem`, `liquidation`, `transfer_in`, or `transfer_out`. |
| `stage`      | string  | `processing` or `priced`.                                                                     |
| `direction`  | string  | `in` or `out`.                                                                                |
| `unit`       | string  | `asset` or `shares`.                                                                          |
| `amount`     | string  | Amount in `unit`.                                                                             |
| `count`      | integer | Number of entries in the cell.                                                                |

A fund may include `bridge.pendingStatus`: `source_evidence_verified` or `unavailable`.

## Profit and loss

`GET /users/{address}/pnl`

How much one wallet has earned right now, across every fund: totals, the 24-hour change, and one row per fund.

Settled value excludes in-flight value. Total value is settled value plus in-flight value. `totalWealth` repeats total value and is deprecated.

```bash
curl "https://mainnet-gw.sodex.dev/api/v1/wealth/users/0x1111111111111111111111111111111111111111/pnl" \
  -H "Accept: application/json"
```

| Field                | Type              | Description                                |
| -------------------- | ----------------- | ------------------------------------------ |
| `address`            | string            | Wallet address.                            |
| `currency`           | string            | Reporting currency.                        |
| `settledValue`       | string            | Settled market value.                      |
| `totalCost`          | string            | Total cost.                                |
| `totalPnl`           | string            | Total profit and loss.                     |
| `totalRealizedPnl`   | string            | Realized profit and loss.                  |
| `totalUnrealizedPnl` | string            | Unrealized profit and loss.                |
| `totalPnl24h`        | string            | Change over 24 hours.                      |
| `inFlightValue`      | string            | Value not yet settled.                     |
| `totalValue`         | string            | `settledValue` plus `inFlightValue`.       |
| `totalWealth`        | string            | Same number as `totalValue`. Deprecated.   |
| `unpricedFunds`      | integer, optional | Count of funds with no price.              |
| `complete`           | boolean, optional | Whether every fund was priced.             |
| `incompleteFunds`    | array, optional   | Fund ids excluded from the totals.         |
| `incomplete24hFunds` | array, optional   | Fund ids excluded from the 24-hour change. |
| `bridgeStatus`       | string, optional  | `ready`, `partial`, or `unavailable`.      |
| `positions`          | array             | One row per fund.                          |

When `priced` is false, price-derived fields are omitted.

| Position field       | Type             | Description                                        |
| -------------------- | ---------------- | -------------------------------------------------- |
| `fundId`             | string           | Fund identifier.                                   |
| `source`             | string           | `vault`, `clob`, or `bridge`.                      |
| `shares`             | string           | Share amount.                                      |
| `avgCostWithAirdrop` | string, optional | Average cost including airdrops.                   |
| `price`              | string, optional | Price used for this row.                           |
| `priceAsOf`          | string, optional | Price time.                                        |
| `marketValue`        | string, optional | Settled market value.                              |
| `unrealizedPnl`      | string, optional | Unrealized profit and loss.                        |
| `realizedPnl`        | string, optional | Realized profit and loss.                          |
| `pnl24h`             | string, optional | 24-hour change.                                    |
| `price24hAgo`        | string, optional | Price 24 hours earlier.                            |
| `priced`             | boolean          | Whether a price was applied.                       |
| `bridge`             | object, optional | Same bridge object as on a [position](#positions). |

## PnL history

`GET /users/{address}/pnl-history`

The same formula as the snapshot, bucketed over time. Each point is realized profit plus unrealized profit on holdings at that time. `All` starts at the wallet's first position event. A wallet with no position returns no points.

```bash
curl "https://mainnet-gw.sodex.dev/api/v1/wealth/users/0x1111111111111111111111111111111111111111/pnl-history?interval=1d&range=1M" \
  -H "Accept: application/json"
```

| Name       | Type   | Required | Description                                                                         |
| ---------- | ------ | -------- | ----------------------------------------------------------------------------------- |
| `address`  | string | Yes      | Path. User EVM address.                                                             |
| `interval` | string | No       | `1m`, `5m`, `15m`, `1h`, `4h`, or `1d`. Default `1d`.                               |
| `range`    | string | No       | `1W`, `1M`, `3M`, `1Y`, or `All`. Case-insensitive. Default `1M`. `1D` is rejected. |

| Field             | Type             | Description                           |
| ----------------- | ---------------- | ------------------------------------- |
| `address`         | string           | Wallet address.                       |
| `currency`        | string           | Reporting currency.                   |
| `interval`        | string           | Applied interval.                     |
| `range`           | string           | Applied range.                        |
| `points`          | array            | Oldest first.                         |
| `bridgeStatus`    | string, optional | `ready`, `partial`, or `unavailable`. |
| `incompleteFunds` | array, optional  | Fund ids that were incomplete.        |
| `accountingFrom`  | string, optional | Start of the accounting window.       |

Each point has `ts`, `pnl`, `settledValue`, `inFlightValue`, and `totalValue`. `incomplete` is present when that bucket is incomplete.

## TVL

`GET /users/{address}/tvl`

Settled USD market value, excluding in-flight value. This reads the latest stored hourly snapshot and does not recompute holdings live. For live assets and profit, use [Profit and loss](#profit-and-loss).

```bash
curl "https://mainnet-gw.sodex.dev/api/v1/wealth/users/0x1111111111111111111111111111111111111111/tvl" \
  -H "Accept: application/json"
```

| Field                | Type              | Description                             |
| -------------------- | ----------------- | --------------------------------------- |
| `address`            | string            | Wallet address.                         |
| `currency`           | string            | Reporting currency.                     |
| `settledValue`       | string            | Settled market value at `snapshotAt`.   |
| `snapshotAt`         | string, optional  | Snapshot time.                          |
| `incomplete`         | boolean           | Whether the snapshot is missing a fund. |
| `bridgeSettledValue` | string, optional  | Settled value of the bridged portion.   |
| `unpricedFunds`      | integer, optional | Count of funds with no price.           |

An empty `settledValue` with no `snapshotAt` means no stored snapshot.
