Get Token Balances + Performance

This endpoint returns Current Token Balance, Cost and Performance data for one or more registered wallets, including Price, Balance, Value, Cost Basis, Realized PnL and Unrealized PnL. Use this endpoint for real-time pricing and Live or Historical P&L reporting for tokens.

  • Pricing - Real-time token Prices are sourced from 4 reputable sources, ensuring completeness in pricing coverage and redundancy.
  • Accounting Method - Cost Basis and Realized P&L accounting methodology (FIFO, LIFO, Weighted Average Cost) can be selected using the cost_method parameter.
    • Cost Basis is inclusive of gas fees paid in the transaction.
    • The selected accounting method is used to calculate cost basis for Realized P&L, which matches the tokens realized to a specific cost based on the relevant accounting method.
    • Unrealized P&L is calculated based on potential gain/loss versus the average cost of the token inventory held.
  • Realization Events - Realized P&L represents potential tax realization events as defined in the U.S. Realization events are defined in the Glossary. For Realized P&L, data is available for multiple time periods (D, W, M, 3M, YTD, 1YR, Max). Desired period is selected using the period parameter.
  • Claimed Income - The Income attribute will show any token reward income you've claimed from DeFi protocols OpenPool supports. Default is USD, but other currency can be selected. Currency conversions are done as of time of claim.
  • Currency - Accounting data can be calculated and shown in the currency of your choice using the currency parameter. Choose from US Dollar, ETH, MATIC, AVAX or xDAI.

Successful Query Example

Single Wallet

curl --request GET \
     --url 'https://api.openpool.co/wallet/balance/?wallet=0x59a5493513ba2378ed57ae5ecfb8a027e9d80365&period=M' \
     --header 'X-API-KEY: <insert_api_key>' \
     --header 'accept: application/json'

Multiple Wallets

curl --request GET \
     --url 'https://api.openpool.co/wallet/balance/?wallet=0x59a5493513ba2378ed57ae5ecfb8a027e9d80365%2C0x3b3525f60eeea4a1ef554df5425912c2a532875d&period=M' \
     --header 'X-API-KEY: <insert_api_key>' \
     --header 'accept: application/json'

Successful Response Example


"results": [
    {
      "wallet": "0x50ec05ade8280758e2077fcbc08d878d4aef79c3",
      "token": {
        "id": "token_FirimyKxL56VwoUhUFkBKP",
        "asset": {
          "id": "asset_dAH3ZHUcmQs2rrb3tjBj3V",
          "name": "Ethereum",
          "symbol": "ETH",
          "slug": "ethereum",
          "is_debt": false
        },
        "token_id": "0x0000000000000000000000000000000000000000_1",
        "address": "0x0000000000000000000000000000000000000000",
        "blockchain": "blockchain_CXTQHpufgGtMwu8Lktv7Aw"
      },
      "balance": 0.5274,
      "price": 1559.65,
      "value": 822.5594100000001,
      "average_cost": 1256.6778,
      "unrealized_pnl": 159.78753828000006,
      "total_realized_pnl": 1181.4189975,
      "income": {
        "claimed_rewards": 0
      },
      "cost_method": "FIFO",
      "currency": "USD"
    },
    {
      "wallet": "0x50ec05ade8280758e2077fcbc08d878d4aef79c3",
      "token": {
        "id": "token_MVYYe6CcmJQUgQHNP2ttDw",
        "asset": {
          "id": "asset_TiAMikThMrbPZDLqWPRXG2",
          "name": "Polygon",
          "symbol": "MATIC",
          "slug": "polygon",
          "is_debt": false
        },
        "token_id": "0x0000000000000000000000000000000000000000_137",
        "address": "0x0000000000000000000000000000000000000000",
        "blockchain": "blockchain_DUe637q5i7pGcV4rnmio7H"
      },
      "balance": 824.45,
      "price": 0.511701,
      "value": 421.87188944999997,
      "average_cost": 0.8124,
      "unrealized_pnl": -247.91129055000005,
      "total_realized_pnl": 0,
      "income": {
        "claimed_rewards": 0
      },
      "cost_method": "FIFO",
      "currency": "USD"
    },
    {
      "wallet": "0x50ec05ade8280758e2077fcbc08d878d4aef79c3",
      "token": {
        "id": "token_Ew9hJsRzBF7aJqjCbrAsnh",
        "asset": {
          "id": "asset_dAH3ZHUcmQs2rrb3tjBj3V",
          "name": "Ethereum",
          "symbol": "ETH",
          "slug": "ethereum",
          "is_debt": false
        },
        "token_id": "0x0000000000000000000000000000000000000000_42161",
        "address": "0x0000000000000000000000000000000000000000",
        "blockchain": "blockchain_3pCy2g5sCSNk6MWGgvY2NP"
      },
      "balance": 0.9965,
      "price": 1559.65,
      "value": 1554.1912250000003,
      "average_cost": 1220.7017,
      "unrealized_pnl": 337.76198095,
      "total_realized_pnl": 0,
      "income": {
        "claimed_rewards": 0
      },
      "cost_method": "FIFO",
      "currency": "USD"
    },
  
    }
  ]
}
Language
Authorization
Click Try It! to start a request and see the response here!