Skip to main content

Overview

The SDK provides methods to track user financial activity:
  • getUserPnl - Get profit/loss summary with optional time-series
  • getUserHistory - Get unified transaction history (fills, settlements, deposits, withdrawals)
To avoid ambiguity, we denote the smallest possible multiple of USDC (0.000001 USDC) as one uusdc, which stands for µUSDC (micro-USDC), and denote the smallest possible multiple of a contract (0.01 contract) as one ccontract (centicontract).User-facing USDC balances are specified as fixed-point strings (e.g. "1.2625" for USDC). Contract quantities in the API and SDK are specified as integer ccontracts strings (e.g. "1050" for 10.50 contracts at precision 2).

Getting PNL

getUserPnl

Get a comprehensive PNL summary for a user.

Parameters

string
required
User’s Ethereum address
object
Optional filtering parameters

Response

Examples

Basic PNL summary:
PNL with daily time series (for charts):
PNL for a specific market:
PNL for a date range:

Getting Transaction History

getUserHistory

Get a chronological list of all financial transactions.

Parameters

string
required
User’s Ethereum address
object
Optional filtering and pagination

Response

Returns an array of transaction records, each with a type discriminator:

Examples

Get all recent activity:
Get only fills for a market:
Paginate through all history:

Error Handling

Important Notes

  • All monetary values are in µUSDC (1 USD = 1,000,000 µUSDC)
  • When filtering by marketId, deposits and withdrawals are excluded from PNL calculations
  • Transaction history is sorted newest-first by default
  • Unrealized PNL is estimated based on position cost basis
  • Time series data points represent cumulative PNL at each interval