Overview
Retrieve realized profit and loss (PnL) data for a specific wallet address. This endpoint tracks realized gains and losses from completed trades (sells or redeems) aggregated by your specified time granularity.Realized PnL Only: This endpoint tracks realized gains/losses from executed trades only. Unrealized PnL from current open positions is not included. For a complete portfolio view, you should also track unrealized PnL separately.
Use Cases
- Portfolio Performance Analysis: Track how your trading strategy has performed over time
- Tax Reporting: Calculate realized gains and losses for tax year planning and reporting
- Performance Tracking: Analyze PnL trends across different time periods (daily, weekly, monthly, yearly)
- Risk Assessment: Understand cumulative performance and volatility patterns
Endpoint
Authentication
All requests require an API key passed in thex-api-key header:
You can find your API key in your account settings. Keep it secure and never share it publicly.
Path Parameters
The Ethereum wallet address to retrieve PnL data for. Must be a valid Ethereum address (0x-prefixed, 42 characters).Examples:
0x12345678901234567890123456789012345678900xaAbBcCddEeFfAaBbCcDdEeFfAaBbCcDdEeFfAaBb
Query Parameters
Time granularity for aggregating PnL data.Allowed values:
daily- Daily PnL aggregationweekly- Weekly PnL aggregation (Monday-Sunday)monthly- Monthly PnL aggregation (calendar month)yearly- Yearly PnL aggregation (calendar year)
Unix timestamp (seconds) for the start of the query period.
- Minimum value:
0 - Default: First trade timestamp for the wallet
- Must be less than
end_time
Unix timestamp (seconds) for the end of the query period.
- Minimum value:
0 - Default: Current Unix timestamp
- Must be greater than
start_time
Response
The endpoint returns a time-series PnL structure with realized gains/losses aggregated by the specified granularity.The time granularity used for aggregation (daily, weekly, monthly, or yearly).
Unix timestamp (seconds) for the start of the returned data period.
Unix timestamp (seconds) for the end of the returned data period.
The Ethereum wallet address for which PnL was calculated.
Array of PnL data points, one per time period (day, week, month, or year).
Response Schema
Error Responses
HTTP status code
Error message describing what went wrong
Common Errors
| Status | Error | Resolution |
|---|---|---|
| 400 | Invalid wallet address format | Ensure the wallet address is a valid 42-character Ethereum address starting with 0x |
| 400 | start_time must be less than end_time | Verify that your start_time timestamp is earlier than end_time |
| 401 | Unauthorized - Invalid API key | Check that your x-api-key header is correct |
| 404 | Wallet not found | The wallet address has no recorded trading history |
| 429 | Rate limit exceeded | Too many requests. Please wait before retrying |
| 500 | Internal server error | Temporary issue. Please try again or contact support |
Examples
Data Interpretation
Understanding the Response Fields
realized_pnl: The profit or loss during this specific period only.- Positive values indicate profit
- Negative values indicate losses
- Calculated from actual executed trades (sells/redeems)
- Shows total accumulated gains/losses
- Useful for understanding overall portfolio performance
- Always increases or decreases monotonically from start to end
- Helps identify periods of high vs. low trading activity
- A period with 0 trades will have 0 realized_pnl
Example Analysis
Validation Rules
start_timemust be less thanend_timestart_timeandend_timemust be non-negative integers (Unix timestamps)wallet_addressmust be a valid Ethereum address format (0x-prefixed, 42 characters)granularitymust be one of: daily, weekly, monthly, yearly- If no parameters are provided beyond wallet_address and granularity, the endpoint will return all available historical data
Rate Limiting
- Standard rate limit: 100 requests per minute
- Burst limit: 10 requests per second
- Rate limit headers are included in responses:
X-RateLimit-Limit: Maximum requests allowedX-RateLimit-Remaining: Requests remaining in current windowX-RateLimit-Reset: Unix timestamp when limit resets
For high-volume queries, consider caching results locally and only fetching new data periodically.
Best Practices
-
Specify Time Ranges: Rather than querying entire history, specify meaningful
start_timeandend_timevalues for better performance. -
Choose Appropriate Granularity:
- Use
dailyfor recent trading activity analysis - Use
weeklyfor short-term trends (weeks to months) - Use
monthlyfor medium-term analysis (quarter to year) - Use
yearlyfor long-term historical analysis
- Use
-
Handle Empty Periods: A period with
num_trades: 0andrealized_pnl: 0means no trades occurred during that period. -
Tax Reporting: For tax purposes, group by
yearlyormonthlygranularity and trackrealized_pnlcarefully, as this represents taxable gains/losses. -
Error Handling: Always check HTTP status codes and handle 400/401/404 errors gracefully:
FAQ
What's the difference between realized and unrealized PnL?
What's the difference between realized and unrealized PnL?
- Realized PnL: Gains/losses from completed trades (sells, redeems). This is what this endpoint returns.
- Unrealized PnL: Gains/losses from positions you still hold. These are potential profits that could change.
Can I get intra-day (hourly) PnL data?
Can I get intra-day (hourly) PnL data?
No, the finest granularity available is daily. For intra-day analysis, you can query multiple daily periods and analyze the pattern.
What timezone are the timestamps in?
What timezone are the timestamps in?
All timestamps are in Unix format (seconds since January 1, 1970 UTC). The period start times are always at 00:00:00 UTC for daily periods, and Monday 00:00:00 UTC for weekly periods.
How far back can I query PnL data?
How far back can I query PnL data?
You can query any period from the wallet’s first recorded trade up to the current time. If you provide no start_time, it defaults to the first trade.
Why does my wallet show 0 realized PnL?
Why does my wallet show 0 realized PnL?
This could mean:
- The wallet has never made a sell or redeem transaction
- The wallet only has open/unrealized positions
- The time range you specified has no trades
num_trades field to verify if trades occurred during the period.Can I use this for backtesting?
Can I use this for backtesting?
Yes, this endpoint provides historical realized PnL data which can inform strategy analysis and backtesting analysis, though it represents past performance only.
