Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.polynode.dev/llms.txt

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

Returns a per-bucket time series of realized P&L for a wallet. Each row is a fixed time window (hour, day, week, or month) with the sum of realized P&L, gross profit, gross loss, wins, losses, and event count for that bucket. A running cumulative_pnl is included so the response can be plotted directly. Backed by an indexed scan over pnl_event — sub-second on full-history windows in most cases.

Request

GET /v3/wallets/{address}/pnl/events

Query parameters

ParameterTypeDefaultDescription
groupstringdayBucket size: hour, day, week, month
periodstringShortcut for after: 1d, 7d, 30d, 1y
afterinteger0Start timestamp (Unix seconds, inclusive)
beforeintegernowEnd timestamp (Unix seconds, inclusive)
limitinteger5000Max buckets returned, clamped 1-10000
If after and period are both set, after wins.

Examples

Daily P&L for the last 7 days

curl "https://api.polynode.dev/v3/wallets/0x44c1dfe43260c94ed4f1d00de2e1f80fb113ebc1/pnl/events?period=7d&group=day"
{
  "address": "0x44c1dfe43260c94ed4f1d00de2e1f80fb113ebc1",
  "granularity": "day",
  "after": 1778478745,
  "before": 1779083545,
  "bucket_count": 3,
  "buckets": [
    {
      "bucket": 1778889600,
      "realized_pnl": 0.000525,
      "cumulative_pnl": 0.000525,
      "gross_profit": 0.000525,
      "gross_loss": 0,
      "wins": 1,
      "losses": 0,
      "events": 1
    },
    {
      "bucket": 1778976000,
      "realized_pnl": 611.069702,
      "cumulative_pnl": 611.070227,
      "gross_profit": 618.41811,
      "gross_loss": -7.348408,
      "wins": 23,
      "losses": 3,
      "events": 26
    },
    {
      "bucket": 1779062400,
      "realized_pnl": 11.774724,
      "cumulative_pnl": 622.844951,
      "gross_profit": 11.774724,
      "gross_loss": 0,
      "wins": 2,
      "losses": 0,
      "events": 2
    }
  ],
  "total_realized_pnl": 622.844951,
  "total_events": 29,
  "total_wins": 26,
  "total_losses": 3,
  "source": "pnl_event",
  "elapsed_ms": 4
}

Hourly P&L for an explicit window

curl "https://api.polynode.dev/v3/wallets/0x44c1dfe43260c94ed4f1d00de2e1f80fb113ebc1/pnl/events?after=1778976000&before=1779062400&group=hour"

Weekly P&L for the last year

curl "https://api.polynode.dev/v3/wallets/0x44c1dfe43260c94ed4f1d00de2e1f80fb113ebc1/pnl/events?period=1y&group=week"

Response fields

FieldTypeDescription
addressstringThe wallet address (lowercased)
granularitystringResolved bucket size (hour, day, week, month)
afterintegerStart of the window (Unix seconds, inclusive)
beforeintegerEnd of the window (Unix seconds, inclusive)
bucket_countintegerNumber of buckets returned
bucketsarrayTime-series rows, ordered oldest → newest
buckets[].bucketintegerBucket start timestamp (Unix seconds, UTC, truncated to bucket boundary)
buckets[].realized_pnlnumberRealized P&L in that bucket (USD)
buckets[].cumulative_pnlnumberRunning sum of realized_pnl over the returned series (USD)
buckets[].gross_profitnumberSum of winning events in that bucket (USD)
buckets[].gross_lossnumberSum of losing events in that bucket (USD, negative)
buckets[].winsintegerCount of winning events in that bucket
buckets[].lossesintegerCount of losing events in that bucket
buckets[].eventsintegerTotal P&L events in that bucket
total_realized_pnlnumberSum of realized_pnl across all returned buckets (USD)
total_eventsintegerSum of events across all returned buckets
total_winsintegerSum of wins across all returned buckets
total_lossesintegerSum of losses across all returned buckets
sourcestringAlways pnl_event
elapsed_msintegerServer-side query time in milliseconds

Errors

HTTPWhen
400Invalid wallet address (must be 0x + 40 hex)
400Invalid group value (must be hour, day, week, or month)
400after greater than before