Skip to main content

SimulationBody

Request body for POST variants of action endpoints. Provides the current portfolio state so the API can project post-trade metrics (health factor, borrow capacity, APRs) before and after the trade.

Data source: All fields come directly from the /v1/data/lending/user-positions endpoint. For a given lender + sub-account, use:

GET /v1/data/lending/user-positions?account=0x...&chains=1

// response.data.items[] is an array of lender entries.
// Pick the entry matching your target lender + chain:
const lenderEntry = response.data.items.find(e => e.lender === 'AAVE_V3' && e.chainId === '1')

// Each lenderEntry.data[] contains sub-accounts (usually one, index 0):
const subAccount = lenderEntry.data[0]

// POST body for any action endpoint:
{
"balanceData": subAccount.balanceData,
"aprData": subAccount.aprData,
"positions": subAccount.positions,
"modeId": subAccount.userConfig.selectedMode // optional
}

If the body is omitted, the API fetches balances on-chain automatically (slower, no simulation in response).

balanceData objectrequired

Aggregated balance data for a sub-account.

depositsnumber

Total deposits in USD

Example: 10000.5
debtnumber

Total debt in USD

Example: 5000.25
adjustedDebtnumber

Debt adjusted for borrow factors

Example: 5500
collateralnumber

Collateral value in USD

Example: 9000
collateralAllActivenumber

Collateral if all assets were enabled

Example: 10000.5
borrowDiscountedCollateralnumber

Collateral discounted by borrow factors

Example: 8000
borrowDiscountedCollateralAllActivenumber

Discounted collateral if all enabled

Example: 9000
navnumber

Net asset value (deposits - debt)

Example: 5000.25
deposits24hnumber

Deposits 24h ago (for change calculation)

Example: 9800
debt24hnumber

Debt 24h ago

Example: 4900
nav24hnumber

NAV 24h ago

Example: 4900
rewards object[]nullable

Pending reward token claims. Each entry represents a single reward program.

  • Array [
  • assetstring

    Reward token contract address

    Example: 0xc00e94Cb662C3520282E6f5717214004A7f26888
    totalRewardsnumber

    Total accumulated rewards (token units)

    Example: 12.5
    claimableRewardsnumber

    Immediately claimable rewards (token units)

    Example: 12.5
  • ]
  • aprData objectrequired

    APR breakdown for a sub-account.

    aprnumber

    Net APR (deposit - borrow)

    Example: 2.5
    depositAprnumber

    Weighted deposit APR

    Example: 3.5
    borrowAprnumber

    Weighted borrow APR

    Example: 5.2
    rewardAprnumber

    Total reward APR

    Example: 1.2
    rewardDepositAprnumber

    Reward APR on deposits

    Example: 0.8
    rewardBorrowAprnumber

    Reward APR on borrows

    Example: 0.4
    intrinsicAprnumber

    Intrinsic yield APR (e.g., stETH staking)

    Example: 0
    intrinsicDepositAprnumber

    Intrinsic yield APR portion from deposits

    Example: 0
    intrinsicBorrowAprnumber

    Intrinsic yield APR portion from borrows

    Example: 0
    rewards object

    Per-reward-token APR breakdown. Keys are reward token addresses.

    property name* RewardAprBreakdown

    APR breakdown for a single reward token.

    aprnumber

    Net reward APR (normalized to NAV)

    Example: 0.045
    borrowAprnumber

    Reward APR on borrows

    Example: 0.012
    depositAprnumber

    Reward APR on deposits

    Example: 0.078
    modeIdstring

    Mode/config key from userConfig.selectedMode (defaults to "0")

    Example: 0
    positions object[]

    Current lending positions from the matching sub-account's positions array. The full LendingPosition objects returned by user-positions are accepted — only the fields in SimulationPosition are used. Always include this for accurate health-factor and borrow-capacity projections.

  • Array [
  • marketUidstringrequired

    Unique market identifier (format: {lender}:{chainId}:{address})

    Example: AAVE_V3:1:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
    depositsUSDnumberrequired

    Deposit amount in USD

    Example: 5000
    debtUSDnumberrequired

    Variable debt in USD

    Example: 2000
    debtStableUSDnumberrequired

    Stable debt in USD

    Example: 0
    collateralEnabledbooleanrequired

    Whether this asset is enabled as collateral

    Example: true
  • ]
  • SimulationBody
    {
    "balanceData": {
    "deposits": 10000.5,
    "debt": 5000.25,
    "adjustedDebt": 5500,
    "collateral": 9000,
    "collateralAllActive": 10000.5,
    "borrowDiscountedCollateral": 8000,
    "borrowDiscountedCollateralAllActive": 9000,
    "nav": 5000.25,
    "deposits24h": 9800,
    "debt24h": 4900,
    "nav24h": 4900,
    "rewards": [
    {
    "asset": "0xc00e94Cb662C3520282E6f5717214004A7f26888",
    "totalRewards": 12.5,
    "claimableRewards": 12.5
    }
    ]
    },
    "aprData": {
    "apr": 2.5,
    "depositApr": 3.5,
    "borrowApr": 5.2,
    "rewardApr": 1.2,
    "rewardDepositApr": 0.8,
    "rewardBorrowApr": 0.4,
    "intrinsicApr": 0,
    "intrinsicDepositApr": 0,
    "intrinsicBorrowApr": 0,
    "rewards": {}
    },
    "modeId": "0",
    "positions": [
    {
    "marketUid": "AAVE_V3:1:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "depositsUSD": 5000,
    "debtUSD": 2000,
    "debtStableUSD": 0,
    "collateralEnabled": true
    }
    ]
    }