Skip to main content
GET
/
api
/
sol
/
wallets
/
{address}
/
pnl
/
history
Time-series FIFO PnL with unrealized valuation
curl --request GET \
  --url 'https://ca.raze.sh/api/sol/wallets/{address}/pnl/history?apiKey='
{
  "success": true,
  "address": "VJSDW6S74YXR4rRR9P4xwhMvLZJQMhrUb8XMFirUsy1",
  "resolution": "1h",
  "data": [
    {
      "bucket": "2024-11-14T10:00:00+00:00",
      "realizedPnlSol": 0.15,
      "unrealizedPnlSol": 0.02,
      "totalPnlSol": 0.17,
      "solPriceUsd": 245.3
    },
    {
      "bucket": "2024-11-14T11:00:00+00:00",
      "realizedPnlSol": 0.15,
      "unrealizedPnlSol": -0.01,
      "totalPnlSol": 0.14,
      "solPriceUsd": 246.1
    }
  ],
  "count": 2,
  "tradesProcessed": 420,
  "truncated": false,
  "tokensTracked": 12,
  "solPriceUsd": 246.5,
  "timestamp": "2024-11-14T12:05:00Z"
}

Documentation Index

Fetch the complete documentation index at: https://docs.raze.bot/llms.txt

Use this file to discover all available pages before exploring further.

Overview

FIFO time-series PnL in SOL: each bucket has cumulative realized PnL, unrealized PnL (open lots marked from OHLCV), and totalPnlSol (realized + unrealized). Wallet-wide and per-mint modes use the same accounting; per-mint is a slice of that engine for one mint.

Requests

Wallet-widefrom and to (Unix seconds) are required:
GET /api/sol/wallets/{address}/pnl/history?from=1730995200&to=1731600000&resolution=1h
Per-token, auto window — first trade on that mint (hour/day aligned) through now; omit from and to:
GET /api/sol/wallets/{address}/pnl/history?mint=So11111111111111111111111111111111111111112&resolution=1h
Per-token, explicit window:
GET /api/sol/wallets/{address}/pnl/history?mint=So11111111111111111111111111111111111111112&from=1730995200&to=1731600000&resolution=1h
Optional: limit (default 50000) caps how many trades are read (globally for wallet-wide; per mint for mint=).

Example responses

Wallet-wide (excerpt):
{
  "success": true,
  "address": "VJSDW6S74YXR4rRR9P4xwhMvLZJQMhrUb8XMFirUsy1",
  "resolution": "1h",
  "data": [
    {
      "bucket": "2024-11-14T10:00:00+00:00",
      "realizedPnlSol": 0.15,
      "unrealizedPnlSol": 0.02,
      "totalPnlSol": 0.17,
      "solPriceUsd": 245.3
    }
  ],
  "count": 1,
  "tradesProcessed": 420,
  "truncated": false,
  "tokensTracked": 12,
  "solPriceUsd": 246.5,
  "timestamp": "2024-11-14T12:05:00Z"
}
Per-mint with auto window (note mint, from, to, no tokensTracked):
{
  "success": true,
  "address": "VJSDW6S74YXR4rRR9P4xwhMvLZJQMhrUb8XMFirUsy1",
  "mint": "So11111111111111111111111111111111111111112",
  "from": 1730995200,
  "to": 1731600000,
  "resolution": "1h",
  "data": [
    {
      "bucket": "2024-11-07T16:00:00+00:00",
      "realizedPnlSol": 0,
      "unrealizedPnlSol": -0.05,
      "totalPnlSol": -0.05,
      "solPriceUsd": 168.2
    },
    {
      "bucket": "2024-11-07T17:00:00+00:00",
      "realizedPnlSol": 0.12,
      "unrealizedPnlSol": 0,
      "totalPnlSol": 0.12,
      "solPriceUsd": 169.0
    }
  ],
  "count": 2,
  "tradesProcessed": 28,
  "truncated": false,
  "solPriceUsd": 170.1,
  "timestamp": "2024-11-14T12:05:00Z"
}
When truncated is true, raise limit or narrow the time range; the FIFO replay may not include older trades.

Authorizations

apiKey
string
query
required

Path Parameters

address
string
required

Query Parameters

mint
string

Token mint (base58). When set, series is scoped to this mint only; from/to are both required unless both omitted (auto window).

from
integer

Start timestamp (Unix seconds). Required when mint is omitted; with mint, omit together with to for auto window.

to
integer

End timestamp (Unix seconds). Required when mint is omitted; with mint, omit together with from for auto window.

resolution
enum<string>
default:1h

Time bucket resolution

Available options:
1h,
1d
limit
integer
default:50000

Maximum trades to process (wallet-wide uses global trade cap; per-mint uses cap on trades for that mint only)

Required range: x <= 50000

Response

Success

success
boolean
address
string
mint
string

Present when the request scoped PnL to a single token mint.

from
integer

Resolved window start (Unix seconds); included for mint-scoped responses with an explicit or auto-derived range.

to
integer

Resolved window end (Unix seconds); included for mint-scoped responses.

resolution
enum<string>
Available options:
1h,
1d
data
object[]
count
integer
tradesProcessed
integer
truncated
boolean

True if trade rows hit limit (wallet-wide or per-mint); PnL may be incomplete past the cap.

tokensTracked
integer

Number of unique tokens in the processed trade set (wallet-wide only).

solPriceUsd
number
timestamp
string<date-time>