Skip to main content
GET
/
v2
/
earn
/
positions
Python (SDK)
from compass_api_sdk import CompassAPI, models


with CompassAPI(
    api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:

    res = compass_api.earn.earn_positions(chain=models.V2EarnPositionsChain.BASE, owner="0x06A9aF046187895AcFc7258450B15397CAc67400")

    # Handle response
    print(res)
{
  "aave": [
    {
      "balance": "1250.5432100000",
      "deposits": [],
      "pnl": {
        "current_value": "1250.5432100000",
        "realized_pnl": "0.0000000000",
        "total_deposited": "1200.0000000000",
        "total_pnl": "50.5432100000",
        "total_pnl_percent": "4.2119341667",
        "unrealized_pnl": "50.5432100000"
      },
      "reserve_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "reserve_symbol": "USDC",
      "type": "AAVE",
      "withdrawals": []
    }
  ],
  "vaults": [
    {
      "balance": "5000.1234560000",
      "deposits": [],
      "pnl": {
        "current_value": "5000.1234560000",
        "realized_pnl": "0.0000000000",
        "total_deposited": "4800.0000000000",
        "total_pnl": "200.1234560000",
        "total_pnl_percent": "4.1692386667",
        "unrealized_pnl": "200.1234560000"
      },
      "type": "VAULT",
      "underlying_symbol": "USDC",
      "vault_address": "0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB",
      "vault_name": "Steakhouse USDC",
      "withdrawals": []
    }
  ],
  "pendle_pt": [
    {
      "deposits": [],
      "expiry": 1735689600,
      "market_address": "0x7d372819240D14fB477f17b964f95F33BeB4c704",
      "pnl": {
        "current_value": "2.5000000000",
        "realized_pnl": "0.0000000000",
        "total_deposited": "2.4500000000",
        "total_pnl": "0.0500000000",
        "total_pnl_percent": "2.0408163265",
        "unrealized_pnl": "0.0500000000"
      },
      "pt_address": "0x7d372819240D14fB477f17b964f95F33BeB4c704",
      "pt_balance": "2.5000000000",
      "type": "PENDLE_PT",
      "underlying_symbol": "weETH",
      "withdrawals": []
    }
  ],
  "total_usd_value": "<string>"
}

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Query Parameters

chain
enum<string>
default:base
required
Available options:
arbitrum,
base,
ethereum,
tempo
owner
string
default:0x06A9aF046187895AcFc7258450B15397CAc67400
required

The address of the owner of the earn account to get positions for.

Response

Successful Response

Grouped positions by protocol.

This new structure groups positions by protocol type for better organization and removes the need for a discriminated union in SDK consumers.

aave
AavePosition · object[]

Aave V3 lending positions.

Example:
[
{
"balance": "1250.5432100000",
"deposits": [],
"pnl": {
"current_value": "1250.5432100000",
"realized_pnl": "0.0000000000",
"total_deposited": "1200.0000000000",
"total_pnl": "50.5432100000",
"total_pnl_percent": "4.2119341667",
"unrealized_pnl": "50.5432100000"
},
"reserve_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"reserve_symbol": "USDC",
"type": "AAVE",
"withdrawals": []
}
]
vaults
VaultPosition · object[]

ERC-4626 vault positions.

Example:
[
{
"balance": "5000.1234560000",
"deposits": [],
"pnl": {
"current_value": "5000.1234560000",
"realized_pnl": "0.0000000000",
"total_deposited": "4800.0000000000",
"total_pnl": "200.1234560000",
"total_pnl_percent": "4.1692386667",
"unrealized_pnl": "200.1234560000"
},
"type": "VAULT",
"underlying_symbol": "USDC",
"vault_address": "0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB",
"vault_name": "Steakhouse USDC",
"withdrawals": []
}
]
pendle_pt
PendlePTPosition · object[]

Pendle Principal Token positions.

Example:
[
{
"deposits": [],
"expiry": 1735689600,
"market_address": "0x7d372819240D14fB477f17b964f95F33BeB4c704",
"pnl": {
"current_value": "2.5000000000",
"realized_pnl": "0.0000000000",
"total_deposited": "2.4500000000",
"total_pnl": "0.0500000000",
"total_pnl_percent": "2.0408163265",
"unrealized_pnl": "0.0500000000"
},
"pt_address": "0x7d372819240D14fB477f17b964f95F33BeB4c704",
"pt_balance": "2.5000000000",
"type": "PENDLE_PT",
"underlying_symbol": "weETH",
"withdrawals": []
}
]
total_usd_value
string | null

Total USD value of all positions (sum of available values).