Wallet API
Wallet
Get Aggregated PNL

Get Aggregated PNL - Wallet API

Get Aggregated PNL - The Aggregated PnL (Profit and Loss) data is provided for multiple specific positions across different wallets and DeFi protocols in a single consolidated calculation.

Get Aggregated PNL - [Value: 334000CU]
Returns aggregated Profit & Loss data for multiple wallets or positions
POST https://lb.drpc.live/{chain}/{key}/lambda/v1/aggregated-pnl-history
Use cases

Use cases

  • The user’s own funds are separated from rewards. This allows us to account for both Profit & Loss movements and rewards, while incoming transfers, top-ups, and withdrawals are not considered as sources of income or loss
  • Support blue chip tokens and DeFi positions across major EVM chains.
Constraints

Constraints

  • The current version is limited to open DeFi positions, while the next update will support historical closed positions as well.
  • Requires valid chain and wallet address
  • Time range parameters affect response size
Get started
Unlock Access to 100+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl --request POST \
  --url https://lb.drpc.live/{chain}/{key}/lambda/v1/aggregated-pnl-history \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{
    "addresses": ["0x..."],
    "from_timestamp": 1710000000,
    "to_timestamp": 1711000000,
    "interval": "day"
  }'
Copy
Response
200
{
  "data": [
    {
      "chain_id": "base",
      "chain_name": "Base",
      "chain_icon_url": "https://static.lambda.p2p.org/chains/base.png",
      "category": "erc20",
      "wallet_address": "0xdb6e9e7390e9acc34619e56efa48ade01cff6f12",
      "position_id": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3",
      "summary": {
        "start": "2025-08-06T00:00:01+00:00",
        "end": "2025-09-05T08:30:01+00:00",
        "pnl_usd": 2822871.721936092,
        "tokens": [
          {
            "id": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3",
            "symbol": "superOETHb",
            "name": "Super OETH",
            "position_type": "supply",
            "icon_url": "https://static.lambda.p2p.org/tokens/base/0xdbfefd2e8460a6ee4955a68582f85708baea60a3.png",
            "defi_id": "erc20",
            "defi_name": "Erc20",
            "attributes": {
              "address": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3",
              "decimals": 18,
              "chain_id": "base",
              "chain_name": "Base",
              "chain_id_numeric": 8453
            },
            "start_balance": {
              "balance": 2628.0887891055277,
              "price": 3627.1475841511256
            },
            "end_balance": {
              "balance": 4128.087289105528,
              "price": 4310.9683282972
            }
          }
        ]
      },
      "pnl_history": [
        {
          "time": "2025-08-06T00:00:01+00:00",
          "balance_usd": 9532465.902338771,
          "reward_usd": 0,
          "reward_usd_net": 0,
          "pnl_usd": 0,
          "profit_gains_usd": 0,
          "token_amount": 2628.0887891055277
        },
        {
          "time": "2025-08-06T10:04:08+00:00",
          "balance_usd": 9532465.902338771,
          "reward_usd": 0,
          "reward_usd_net": 0,
          "pnl_usd": 0,
          "profit_gains_usd": 0,
          "token_amount": 2628.0887891055277
        }
      ],
      "user_activities": [
        {
          "time": "2025-08-06T10:04:09+00:00",
          "type": "deposit",
          "symbol": "superOETHb",
          "amount": 1499.9985000000001,
          "value_usd": 5440715.935505313,
          "transaction_hash": "0x8e7b341a70da11525d247928ee2894cd4b57ca7f8addf0d4a304c87d8588710f"
        }
      ],
      "reward_history": []
    }
  ]
}
Copy

Path params

Parameters
chainstring
[Required] Target chain
keystring
[Required] Your dRPC API key

Query params

ParametersThis method does not accept any parameters.

Request params

Parametersarray of objects
array of objects
start_timestampinteger
≥ 0. The start timestamp in milliseconds. Default: now - 30 days.
end_timestampinteger
≥ 0. The end timestamp in milliseconds. Default: now.
granularitystring
Granularity. Default: day.
  • month - null
  • week - null
  • day - null
  • hour - null
  • five_minutes - null
  • any - null
points_limitinteger
2 to 100. The maximum number of points to return. Default: 100. Max: 100.
positionsarray_of_objects
List of specific positions (wallet address + category + position ID) to calculate aggregated PnL for. Each position represents a unique token or DeFi position.
array of objects
addressstring
Wallet address of the position
categorystring
[Required] The category of the PnL.
  • erc20 - ERC-20 tokens
  • native - Native tokens
  • aave-v3-supply - AAVE V3 Lending
  • aave-v3-borrow - AAVE V3 Borrowing
  • uni-v2-supply - Uniswap V2
  • uni-v3-supply - Uniswap V3
  • sushi-v2-supply - SushiSwap V2
  • sushi-v3-supply - SushiSwap V3
  • lido - Lido
  • venus-supply - Venus Supply
  • venus-staking - Venus Staking
  • balancer-v2 - Balancer V2
  • aura - Aura
  • morpho-vault - Morpho Vault
  • morpho-market-supply - Morpho Market Supply
  • morpho-market-borrow - Morpho Market Borrow
  • morpho-market-collateral - Morpho Market Collateral
  • renzo - Renzo
  • ether-fi - Ether.fi
  • sky - Sky
  • euler-vesting - Euler Vesting
  • euler-supply - Euler Supply
  • euler-borrow - Euler Borrow
  • pendle - Pendle
  • ethena-staking - Ethena Staking
  • ethena-locked - Ethena Locked
  • ethena-cooldown - Ethena Cooldown
  • gearbox - Gearbox
  • fluid - Fluid
  • kiln - Kiln
  • compound-v3-supply - Compound V3 CToken Supply
  • compound-v3-borrow - Compound V3 Lending Borrow
  • compound-v3-reward - Compound V3 COMP Rewards
  • compound-v3-collateral - Compound V3 Lending Collateral
position_idstring
[Required] The position ID, which depends on the category
  • Uniswap V3 / SushiSwap V3 - {Pool Address}-{Numeric NFT position ID} (e.g., 0xf6c4e4f339912541d3f8ed99dba64a1372af5e5b-123456)
  • Uniswap V2 / SushiSwap V2 - Pool address (hash) (e.g., 0xf6c4e4f339912541d3f8ed99dba64a1372af5e5b)
  • Aave V3 / ERC-20 - aToken/aDebtToken address (e.g., 0xefd6c64533602ac55ab64442307f6fe2c9307305)
  • Morpho Vault - pool address (e.g., 0x0f359fd18bda75e9c49bc027e7da59a4b01bf32a)
  • Morpho Market Supply/Borrow/Collateral - Market id bytes (e.g., 0x64d65c9a2d91c36d56fbc42d69e979335320169b3df63bf92789e2c8883fcc64)
  • Lido - stETH/wstETH address (e.g., 0xae7ab96520de3a18e5e111b5eaab095312d7fe84)
  • Venus Supply - vToken address (e.g., 0xc82780db1257c788f262fbbda960b3706dfdcaf2)
  • Venus Staking - staking pool address (e.g., 0xa0882c2d5df29233a092d2887a258c2b90e9b994)
  • Balancer V2 - pool address (e.g., 0x1e19cf2d73a72ef1332c882f20534b6519be0276)
  • Aura - pool address (e.g., 0xdd1fe5ad401d4777ce89959b7fa587e569bf125d)
  • Renzo - ezETH, pzETH, ezREZ or ezEIGEN address (e.g., 0xdf6097a9e585E3d72556D19fA147562FfEf5D3C7)
  • Ether.fi - eETH, weETH or vault address (e.g., 0x35fa164735182de50811e8e2e824cfb9b6118ac2)
  • Sky - pool address (e.g., 0xa3931d71877c0e7a3148cb7eb4463524fec27fbd)
  • Euler - pool address (e.g., 0xf3e621395fc714b90da337aa9108771597b4e696)
  • Euler Vesting - pool address (e.g., 0xf3e621395fc714b90da337aa9108771597b4e696)
  • Euler Supply - {eToken Address}-{subaccount index} (e.g., 0xf3e621395fc714b90da337aa9108771597b4e696-3)
  • Euler Borrow - {eDebtToken Address}-{subaccount index} (e.g., 0x6200860bcdcb23d3b67a46769affeb91db2b175a-2)
  • Pendle - (AMM, SY, YT, PT, STAKING) pool address (e.g., 0x6d98a2b6cdbf44939362a3e99793339ba2016af4)
  • Gearbox - pool address, diselToken, dToken (e.g., 0xff94993fa7ea27efc943645f95adb36c1b81244b)
  • Curve - pool address of curve_lp_token/gauge_address/veCRV/scrvUSD/vesting (e.g., 0xecd5e75afb02efa118af914515d6521aabd189f1)
  • Curve Collateral - pool address of curve llamalend lending (e.g., 0xeda215b7666936ded834f76f3fbc6f323295110a)
  • Curve Borrow - pool address of curve llamalend lending (e.g., 0xeda215b7666936ded834f76f3fbc6f323295110a)
  • Fluid - fToken address of fluid yield (e.g., 0x6a29a46e21c730dca1d8b23d637c101cec605c5b)
  • Kiln - pool address of kiln (e.g., 0x2401c39d7ba9e283668a53fcc7b8f5fd9e716fdf)
  • Compound V3 Supply - cToken address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3)
  • Compound V3 Lending Borrow - cToken address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3)
  • Compound V3 COMP Rewards - cToken address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3)
  • Compound V3 Lending Collateral - cToken-collateral_token_address address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3-0x2260fac5e5542a773aa44fbcfedf7c193bc2c599)

Response

200

Response params

object
dataarray
[Required] Returns historical records of Profit and Loss (PnL) over time.
object
chain_idstring
[Required] id of the chain
chain_namestring
[Required] name of the chain
chain_icon_urlstring
URL of the chain
categorystring
[Required] Category or DeFi id of the position.
  • erc20 - null
  • native - null
  • aave-v3-supply - null
  • aave-v3-borrow - null
  • uni-v2-supply - null
  • uni-v3-supply - null
  • sushi-v2-supply - null
  • sushi-v3-supply - null
  • lido - null
  • venus-supply - null
  • venus-borrow - null
  • venus-staking - null
  • balancer-v2 - null
  • aura - null
  • morpho-vault - null
  • morpho-market-supply - null
  • morpho-market-borrow - null
  • morpho-market-collateral - null
  • renzo - null
  • ether-fi - null
  • rocket - null
  • sky - null
wallet_addressstring
[Required] Wallet address of the position.
position_idstring
[Required] Position id of the position.
summaryobject
[Required] Summary of the PnL and tokens.
object
startstring
Start timestamp of the summary period.
endstring
End timestamp of the summary period.
pnl_usdnumber
Total PnL in USD.
tokensarray
List of tokens in the position.
object
idstring
Token ID.
symbolstring
Token symbol.
namestring
Token name.
position_typestring
Type of position (e.g., supply, borrow).
icon_urlstring
URL to download token icon.
defi_idstring
DeFi ID of the token.
defi_namestring
Community name of DeFi.
attributesobject
Token attributes.
object
addressstring
Token contract address.
decimalsnumber
Token decimals.
chain_idstring
Chain id.
chain_namestring
Chain name.
chain_id_numericnumber
Numeric chain id.
start_balanceobject
Starting token balance and price.
object
balancenumber
Balance at start.
pricenumber
Token price at start in USD.
end_balanceobject
Ending token balance and price.
object
balancenumber
Balance at end.
pricenumber
Token price at end in USD.
pnl_historyarray
[Required] List of asset changes over time.
object
timestring
[Required] Timestamp of the PnL entry.
balance_usdnumber
[Required] Position balance in USD at the given timestamp.
reward_usdnumber
[Required] Rewards earned in tokens converted to USD (current price).
reward_usd_netnumber
[Required] Rewards in tokens converted using latest price.
pnl_usdnumber
[Required] Total change in portfolio value compared to initial state.
profit_gains_usdnumber
[Required] Net change in token balance adjusted for price fluctuations.
token_amountnumber
[Required] Amount of tokens in the position.
user_activitiesarray
[Required] Withdrawal/Deposits in scope of PnL interval.
object
timestring
[Required] Timestamp of the user activity.
typestring
[Required] Type of user activity.
  • deposit - null
  • withdraw - null
symbolstring
[Required] Token symbol affected.
amountnumber
[Required] Amount of tokens changed.
value_usdnumber
[Required] Value of the token in USD.
transaction_hashstring
[Required] Transaction hash of the activity.
reward_historyarray
[Required] List of rewards earned during the PnL interval.
object
timestring
[Required] Timestamp of the reward.
typestring
[Required] Type of reward.
  • supply - null
  • borrow - null
  • stake - null
  • reward - null
symbolstring
[Required] Token symbol of the reward.
namestring
[Required] Token name of the reward.
icon_urlstring
URL to download icon of the token.
amountnumber
[Required] Amount of reward tokens.
pricenumber
[Required] Price of the reward token in USD.