SettleMint
Tokens

Unrealized P&L over time

Read a participant's unrealized profit and loss for one token as a bucketed time series through the DALP API, scoped to their own linked wallets in the active system.

Use the unrealized P&L over time API when an integration needs to chart how a participant's open position in one token has gained or lost value while they still hold it, for example the sparkline on a holdings row. One call returns a ready-to-plot time series for one token: at each bucket it values the participant's held quantity at the token's resolved price and subtracts the cost basis of that quantity, both in the organisation's base currency. To chart every holding, read the participant's tokens from User asset balances first, then call this endpoint once per token.

This endpoint reports unrealized results for a single token, the gain or loss on a holding the participant still owns. For results the participant has already locked in by closing or reducing positions, see Realized P&L statistics. For the current cost basis and point-in-time unrealized figure across every holding, see User asset balances. For the participant's total portfolio value over time, see Portfolio statistics.

Participant scope

The platform calculates unrealized P&L for the authenticated participant, not for a single address. A participant can hold one token through more than one linked wallet, typically a signing account (EOA) and a smart wallet under account abstraction. The endpoint sums the held quantity and cost basis across the caller's full set of linked wallets in the active system, and never returns another participant's position.

The endpoint scopes every result to the active system from the request context. When a participant holds the same token in more than one DALP system, each system's result covers only that system's holding.

Endpoint

GET /api/v2/user-unrealized-pnl-metrics

The endpoint is read-only. It reports a result the platform has already indexed and does not move assets or change holdings. For authentication and base URL setup, see Getting started.

curl --request GET \
  "$DALP_API_URL/api/v2/user-unrealized-pnl-metrics?tokenAddress=0x71C7656EC7ab88b098defB751B7401B5f6d8976F&preset=trailing7Days" \
  --header "X-Api-Key: $DALP_API_TOKEN"

Both query parameters are required. Pass tokenAddress to select the token contract whose unrealized P&L series you want; the series covers one token per request. Pass preset to fix both the trailing window and the bucket interval. Each preset resolves to either hourly or daily buckets, so a shorter range returns finer points. The supported presets are:

PresetWindowInterval
trailing24HoursLast 24 hourshour
trailing7DaysLast 7 daysday
trailing1MonthLast 30 daysday
trailing3MonthsLast 3 monthsday
trailing6MonthsLast 6 monthsday
trailing12MonthsLast 12 monthsday
ytdYear to dateday
allTimeFull available historyday

Response shape

The response returns the resolved range alongside one point per bucket, ordered oldest first so a chart can plot the series left to right.

{
  "range": {
    "interval": "day",
    "from": "2026-01-01T00:00:00.000Z",
    "to": "2026-01-08T00:00:00.000Z",
    "isPreset": true
  },
  "data": [
    {
      "timestamp": "2026-01-01T00:00:00.000Z",
      "unrealizedPnlInBase": "0.50"
    },
    {
      "timestamp": "2026-01-02T00:00:00.000Z",
      "unrealizedPnlInBase": "-1.20"
    }
  ]
}

Each point reports:

  • timestamp: the start of the bucket in UTC, at the preset's interval.
  • unrealizedPnlInBase: the participant's held quantity valued at the token's resolved base-currency price as of that bucket, minus the cost basis of that quantity, summed across the participant's accounts. A loss is negative.

The series is evenly spaced. The platform fills every bucket in the range, so a point with no change carries the last known unrealized figure forward instead of dropping to zero. The platform seeds the first point from the holding's state just before the range begins, so the chart starts from a real value, not from zero.

If the platform cannot resolve any wallet for the participant, the endpoint returns the requested range with an empty data list instead of provisioning a wallet as a side effect. The endpoint also returns an empty data list when the token does not resolve inside the active system.

How the figure is calculated

The series reconstructs unrealized P&L from indexed history instead of storing a precomputed series:

  • The platform tracks each change to the participant's held quantity and cost basis for the token, and it tracks the token's price over time.
  • At each point in the series, the platform values the held quantity at the token's resolved base-currency price as of that point and subtracts the cost basis of that quantity. The difference is the unrealized P&L for that bucket.
  • Between changes, the platform carries the last known state forward, so the line stays flat until the next quantity, cost basis, or price change.

This matches the point-in-time unrealized P&L on User asset balances: the latest point of the series equals the unrealizedPnl reported for the same holding. The endpoint returns monetary values in the organisation's base currency, so an integration can display the figures directly without applying another conversion.

On this page