MarginSimulationQuoteResponse
Quote-only loop response enriched with post-trade simulation (POST only).
Protocol identifier. See the LenderId schema.
quotes object[]required
Candidate routes, best output first. Execute exactly one.
deltas object
Aggregator source
Trade input amount
Trade output amount
deltas object
Balance deltas
Balance deltas
rateImpact object[]
Projected interest-rate impact per market for THIS quote (its own trade amounts). Omitted if IRM data is unavailable.
Market identifier (format: lender:chainId:address)
AAVE_V3:8453:0x4200000000000000000000000000000000000006utilization objectrequired
Utilization ratio (0–1)
Current value
Projected value after the action
borrowRate objectrequired
Borrow APR (%)
Current value
Projected value after the action
depositRate objectrequired
Deposit/supply APR (%) paid by the POOL. On a market whose return is the asset itself (an LST, an RWA share such as nOPAL on Morpho Blue) this is 0 — read effectiveDepositRate.
Current value
Projected value after the action
The asset's own yield in percent (LST staking yield, RWA NAV growth, a Gearbox quota rate as a negative), size-invariant, ADDED to both sides: earned on a deposit, forgone on a borrow. Absent when the lender meta was not readable when the response was built — never defaulted to 0 in that case.
10.37Sum of reward-stream APRs (%) on the deposit side. Absent with intrinsicYield.
Sum of reward-stream APRs (%) rebated on the borrow side. Absent with intrinsicYield.
effectiveDepositRate object
depositRate + intrinsicYield (%), rewards EXCLUDED — what a deposit on this market actually earns, and the figure the pair book publishes as the effective supply APR. Absent with intrinsicYield.
Current value
Projected value after the action
effectiveBorrowRate object
borrowRate + intrinsicYield (%), rewards EXCLUDED — what a borrow on this market actually costs. Absent with intrinsicYield.
Current value
Projected value after the action
True when the market has no utilization curve to shift (Morpho Blue collateral, a fixed-rate broker): current === projected, taken from the published rates, and utilization is NaN. Present so the leg is not silently missing from a position preview.
netApr object
The trade's carry at post-trade rates — the position net APR. annualUsd is the change in yearly carry the trade causes (deposit/withdraw legs earn, borrow/repay legs cost); aprPct puts it on the net equity the trade moves (the margin on an open) and is null when that equity is not positive (a pure leverage step, a swap). The bare figures exclude rewards; *Total include them.
legs object[]required
Market identifier, formatted lender:chainId:address.
Possible values: [deposit, borrow, withdraw, repay]
Absolute USD size of the leg.
Effective PROJECTED rate (IRM + intrinsic, %) the leg is priced at; the bare IRM rate where the overlay was unavailable.
ratePct with rewards folded in (+ on an earning leg, − on a paying leg).
economics object
THIS route's trade economics — TradeEconomics on an open, CloseEconomics on a close. Always present once the route has deltas; every unavailable input is a null + a note.
- TradeEconomics
- CloseEconomics
notionalUsd objectrequired
The position this route creates, at the oracle. equity is the margin the user brings (0 on a pure leverage step).
entryCostUsd objectrequired
Day-0 cost of getting in. slippage = swap input at the oracle − swap output at the oracle (floored at 0; slippageBp keeps the sign). gas is null when it could not be priced.
Signed swap-vs-oracle, BP of the swap input. Negative = the route costs money.
entryCostUsd.total over the DEBT notional, BP.
fees object[]required
The term sheet's FeeTerm.id (origination, early-repay-penalty, …) or flash for the flash-loan fee.
entry items sum to entryCostUsd.fees; exit items are in the round-trip exit cost.
Possible values: [entry, exit]
Priced on the notional the fee is charged on. Negative = a rebate.
The published rate (read with unit).
percent | bps | …
principal | face-value | collateral | …
Governance-mutable snapshot — re-verify before quoting it as a term.
carryPerDayUsd objectnullablerequired
The trade's carry per day at PROJECTED rates — what it earns after its own borrow has moved the pool. total counts incentives, base does not. With an account, the repricing of the existing book is netted out.
Possible values: [projected, sticker, none]
breakEvenDays objectrequired
entryCostUsd.total / carryPerDayUsd. Null when the carry is not positive (never pays for itself — see notes) or unknown.
roundTripDays objectrequired
(entry + exit cost) / carry. closeQuoted says whether the exit was PRICED (a real close quote) or ASSUMED symmetric to the entry (the default today). Null on a debt that cannot be repaid early (Midnight): the round trip is at maturity, not before.
Days until the trade's clock runs out. Null = perpetual.
horizon objectrequired
Possible values: [perpetual, to-expiry, to-maturity, rolling]
Unix seconds.
gas objectnullablerequired
- EconomicsGas
Gas units over the whole bundle — outstanding permissions + main transaction.
true when every transaction was eth_estimateGas-ed from the account; false when at least one used the typical-size table (the notes say which — the main transaction usually reverts under estimation until its permissions are granted).
existingExposure object
The marginal view — what this trade does to the account it lands in. The new borrow moves the pool rate, and the debt the account ALREADY holds in that market reprices with it: an ongoing cost the one-off slippage never shows. Same on the deposit side with the opposite sign.
Debt already held in the DEBT market, USD.
Deposits already held in the COLLATERAL market, USD.
Projected − current borrow rate on the debt market, BP.
Projected − current deposit rate on the collateral market, BP.
Repricing of the existing book per day (debt repriced up minus deposits repriced up). Positive = a cost. Already netted out of carryPerDayUsd.
Account net APR before the trade, percent, rewards included.
Account net APR after the trade at PROJECTED rates, percent.
Every assumption and every input that was missing, in words. Read them before showing a number.
notionalUsd objectrequired
exitCostUsd objectrequired
exitCostUsd.total over the debt repaid, BP.
fees object[]required
The term sheet's FeeTerm.id (origination, early-repay-penalty, …) or flash for the flash-loan fee.
entry items sum to entryCostUsd.fees; exit items are in the round-trip exit cost.
Possible values: [entry, exit]
Priced on the notional the fee is charged on. Negative = a rebate.
The published rate (read with unit).
percent | bps | …
principal | face-value | collateral | …
Governance-mutable snapshot — re-verify before quoting it as a term.
carryForgonePerDayUsd objectnullablerequired
Possible values: [projected, sticker, none]
daysOfCarry objectrequired
gas objectnullablerequired
- EconomicsGas
Gas units over the whole bundle — outstanding permissions + main transaction.
true when every transaction was eth_estimateGas-ed from the account; false when at least one used the typical-size table (the notes say which — the main transaction usually reverts under estimation until its permissions are granted).
rateImpact object[]nullable
Projected interest-rate impact per market. Single-market actions produce 1 entry; loop actions produce 2. Null if IRM data is unavailable.
Market identifier (format: lender:chainId:address)
AAVE_V3:8453:0x4200000000000000000000000000000000000006utilization objectrequired
Utilization ratio (0–1)
Current value
Projected value after the action
borrowRate objectrequired
Borrow APR (%)
Current value
Projected value after the action
depositRate objectrequired
Deposit/supply APR (%) paid by the POOL. On a market whose return is the asset itself (an LST, an RWA share such as nOPAL on Morpho Blue) this is 0 — read effectiveDepositRate.
Current value
Projected value after the action
The asset's own yield in percent (LST staking yield, RWA NAV growth, a Gearbox quota rate as a negative), size-invariant, ADDED to both sides: earned on a deposit, forgone on a borrow. Absent when the lender meta was not readable when the response was built — never defaulted to 0 in that case.
10.37Sum of reward-stream APRs (%) on the deposit side. Absent with intrinsicYield.
Sum of reward-stream APRs (%) rebated on the borrow side. Absent with intrinsicYield.
effectiveDepositRate object
depositRate + intrinsicYield (%), rewards EXCLUDED — what a deposit on this market actually earns, and the figure the pair book publishes as the effective supply APR. Absent with intrinsicYield.
Current value
Projected value after the action
effectiveBorrowRate object
borrowRate + intrinsicYield (%), rewards EXCLUDED — what a borrow on this market actually costs. Absent with intrinsicYield.
Current value
Projected value after the action
True when the market has no utilization curve to shift (Morpho Blue collateral, a fixed-rate broker): current === projected, taken from the published rates, and utilization is NaN. Present so the leg is not silently missing from a position preview.
netApr object
The trade's carry at post-trade rates — the position net APR. annualUsd is the change in yearly carry the trade causes (deposit/withdraw legs earn, borrow/repay legs cost); aprPct puts it on the net equity the trade moves (the margin on an open) and is null when that equity is not positive (a pure leverage step, a swap). The bare figures exclude rewards; *Total include them.
legs object[]required
Market identifier, formatted lender:chainId:address.
Possible values: [deposit, borrow, withdraw, repay]
Absolute USD size of the leg.
Effective PROJECTED rate (IRM + intrinsic, %) the leg is priced at; the bare IRM rate where the overlay was unavailable.
ratePct with rewards folded in (+ on an earning leg, − on a paying leg).
economics object
The first (best) quote's economics, mirrored.
- TradeEconomics
- CloseEconomics
notionalUsd objectrequired
The position this route creates, at the oracle. equity is the margin the user brings (0 on a pure leverage step).
entryCostUsd objectrequired
Day-0 cost of getting in. slippage = swap input at the oracle − swap output at the oracle (floored at 0; slippageBp keeps the sign). gas is null when it could not be priced.
Signed swap-vs-oracle, BP of the swap input. Negative = the route costs money.
entryCostUsd.total over the DEBT notional, BP.
fees object[]required
The term sheet's FeeTerm.id (origination, early-repay-penalty, …) or flash for the flash-loan fee.
entry items sum to entryCostUsd.fees; exit items are in the round-trip exit cost.
Possible values: [entry, exit]
Priced on the notional the fee is charged on. Negative = a rebate.
The published rate (read with unit).
percent | bps | …
principal | face-value | collateral | …
Governance-mutable snapshot — re-verify before quoting it as a term.
carryPerDayUsd objectnullablerequired
The trade's carry per day at PROJECTED rates — what it earns after its own borrow has moved the pool. total counts incentives, base does not. With an account, the repricing of the existing book is netted out.
Possible values: [projected, sticker, none]
breakEvenDays objectrequired
entryCostUsd.total / carryPerDayUsd. Null when the carry is not positive (never pays for itself — see notes) or unknown.
roundTripDays objectrequired
(entry + exit cost) / carry. closeQuoted says whether the exit was PRICED (a real close quote) or ASSUMED symmetric to the entry (the default today). Null on a debt that cannot be repaid early (Midnight): the round trip is at maturity, not before.
Days until the trade's clock runs out. Null = perpetual.
horizon objectrequired
Possible values: [perpetual, to-expiry, to-maturity, rolling]
Unix seconds.
gas objectnullablerequired
- EconomicsGas
Gas units over the whole bundle — outstanding permissions + main transaction.
true when every transaction was eth_estimateGas-ed from the account; false when at least one used the typical-size table (the notes say which — the main transaction usually reverts under estimation until its permissions are granted).
existingExposure object
The marginal view — what this trade does to the account it lands in. The new borrow moves the pool rate, and the debt the account ALREADY holds in that market reprices with it: an ongoing cost the one-off slippage never shows. Same on the deposit side with the opposite sign.
Debt already held in the DEBT market, USD.
Deposits already held in the COLLATERAL market, USD.
Projected − current borrow rate on the debt market, BP.
Projected − current deposit rate on the collateral market, BP.
Repricing of the existing book per day (debt repriced up minus deposits repriced up). Positive = a cost. Already netted out of carryPerDayUsd.
Account net APR before the trade, percent, rewards included.
Account net APR after the trade at PROJECTED rates, percent.
Every assumption and every input that was missing, in words. Read them before showing a number.
notionalUsd objectrequired
exitCostUsd objectrequired
exitCostUsd.total over the debt repaid, BP.
fees object[]required
The term sheet's FeeTerm.id (origination, early-repay-penalty, …) or flash for the flash-loan fee.
entry items sum to entryCostUsd.fees; exit items are in the round-trip exit cost.
Possible values: [entry, exit]
Priced on the notional the fee is charged on. Negative = a rebate.
The published rate (read with unit).
percent | bps | …
principal | face-value | collateral | …
Governance-mutable snapshot — re-verify before quoting it as a term.
carryForgonePerDayUsd objectnullablerequired
Possible values: [projected, sticker, none]
daysOfCarry objectrequired
gas objectnullablerequired
- EconomicsGas
Gas units over the whole bundle — outstanding permissions + main transaction.
true when every transaction was eth_estimateGas-ed from the account; false when at least one used the typical-size table (the notes say which — the main transaction usually reverts under estimation until its permissions are granted).
Fee of the flash source the bundle uses, BPS. A day-0 cost the position deltas do not show (the debt delta is the flash PRINCIPAL); priced in economics.fees as flash. Absent when no flash is used or the fee is paid from the swap proceeds.
simulation objectnullable
Projected post-trade metrics, or null if simulation failed
- LoopPostTradeMetrics
pre object
Portfolio state before the trade.
Health factor before the trade (null-safe: capped at 1e18 when no debt)
1.85Borrow capacity (USD) before the trade
3000post object
Projected portfolio state after the trade.
Projected health factor after the trade
2.1Projected borrow capacity (USD) after the trade
3500balanceData object
Aggregated balance data for a sub-account.
Total deposits in USD
10000.5Total debt in USD
5000.25Debt adjusted for borrow factors
5500Collateral value in USD
9000Collateral if all assets were enabled
10000.5Collateral discounted by borrow factors
8000Discounted collateral if all enabled
9000Net asset value (deposits - debt)
5000.25Deposits 24h ago (for change calculation)
9800Debt 24h ago
4900NAV 24h ago
4900rewards object[]nullable
Pending reward token claims. Each entry represents a single reward program.
Reward token contract address
0xc00e94Cb662C3520282E6f5717214004A7f26888Total accumulated rewards (token units)
12.5Immediately claimable rewards (token units)
12.5aprData object
APR breakdown for a sub-account.
Net APR (deposit - borrow)
2.5Weighted deposit APR
3.5Weighted borrow APR
5.2Total reward APR
1.2Reward APR on deposits
0.8Reward APR on borrows
0.4Intrinsic yield APR (e.g., stETH staking)
0Intrinsic yield APR portion from deposits
0Intrinsic yield APR portion from borrows
0rewards object
Per-reward-token APR breakdown. Keys are reward token addresses.
property name* RewardAprBreakdown
APR breakdown for a single reward token.
Net reward APR (normalized to NAV)
0.045Reward APR on borrows
0.012Reward APR on deposits
0.078Error message if simulation failed
{
"lender": "string",
"quotes": [
{
"deltas": {
"aggregator": "string",
"tradeInput": 0,
"tradeOutput": 0,
"deltas": {}
},
"rateImpact": [
{
"marketUid": "AAVE_V3:8453:0x4200000000000000000000000000000000000006",
"utilization": {
"current": 0.85,
"projected": 0.83
},
"borrowRate": {
"current": 3.2,
"projected": 3
},
"depositRate": {
"current": 2.1,
"projected": 1.9
},
"intrinsicYield": 10.37,
"depositRewardApr": 0,
"borrowRewardApr": 0,
"effectiveDepositRate": {
"current": 10.37,
"projected": 10.37
},
"effectiveBorrowRate": {
"current": 0,
"projected": 0
},
"flat": true
}
],
"netApr": {
"annualUsd": 0,
"annualUsdTotal": 0,
"equityUsd": 0,
"aprPct": 0,
"aprPctTotal": 0,
"legs": [
{
"marketUid": "string",
"side": "deposit",
"usd": 0,
"ratePct": 0,
"ratePctTotal": 0
}
]
},
"economics": {
"notionalUsd": {
"equity": 0,
"collateral": 0,
"debt": 0
},
"entryCostUsd": {
"slippage": 0,
"fees": 0,
"gas": 0,
"total": 0
},
"slippageBp": 0,
"entryCostBp": 0,
"fees": [
{
"id": "string",
"label": "string",
"when": "entry",
"usd": 0,
"value": 0,
"unit": "string",
"basis": "string",
"mutable": true
}
],
"carryPerDayUsd": {
"total": 0,
"base": 0
},
"carryBasis": "projected",
"breakEvenDays": {
"total": 0,
"base": 0
},
"roundTripDays": {
"total": 0,
"base": 0,
"closeQuoted": true,
"exitCostUsd": 0
},
"horizonDays": 0,
"horizon": {
"kind": "perpetual",
"endsAt": 0,
"source": "string"
},
"breaksEvenBeforeHorizon": true,
"gas": {
"units": 0,
"txCount": 0,
"estimated": true,
"gasPriceGwei": 0,
"nativePriceUsd": 0,
"usd": 0
},
"existingExposure": {
"debtUsdSameMarket": 0,
"depositUsdSameMarket": 0,
"rateDeltaBp": 0,
"depositRateDeltaBp": 0,
"repriceCostPerDayUsd": 0,
"accountAprPre": 0,
"accountAprPost": 0,
"accountNavUsd": 0,
"accountNavUsdPost": 0
},
"notes": [
"string"
]
}
}
],
"rateImpact": [
{
"marketUid": "AAVE_V3:8453:0x4200000000000000000000000000000000000006",
"utilization": {
"current": 0.85,
"projected": 0.83
},
"borrowRate": {
"current": 3.2,
"projected": 3
},
"depositRate": {
"current": 2.1,
"projected": 1.9
},
"intrinsicYield": 10.37,
"depositRewardApr": 0,
"borrowRewardApr": 0,
"effectiveDepositRate": {
"current": 10.37,
"projected": 10.37
},
"effectiveBorrowRate": {
"current": 0,
"projected": 0
},
"flat": true
}
],
"netApr": {
"annualUsd": 0,
"annualUsdTotal": 0,
"equityUsd": 0,
"aprPct": 0,
"aprPctTotal": 0,
"legs": [
{
"marketUid": "string",
"side": "deposit",
"usd": 0,
"ratePct": 0,
"ratePctTotal": 0
}
]
},
"economics": {
"notionalUsd": {
"equity": 0,
"collateral": 0,
"debt": 0
},
"entryCostUsd": {
"slippage": 0,
"fees": 0,
"gas": 0,
"total": 0
},
"slippageBp": 0,
"entryCostBp": 0,
"fees": [
{
"id": "string",
"label": "string",
"when": "entry",
"usd": 0,
"value": 0,
"unit": "string",
"basis": "string",
"mutable": true
}
],
"carryPerDayUsd": {
"total": 0,
"base": 0
},
"carryBasis": "projected",
"breakEvenDays": {
"total": 0,
"base": 0
},
"roundTripDays": {
"total": 0,
"base": 0,
"closeQuoted": true,
"exitCostUsd": 0
},
"horizonDays": 0,
"horizon": {
"kind": "perpetual",
"endsAt": 0,
"source": "string"
},
"breaksEvenBeforeHorizon": true,
"gas": {
"units": 0,
"txCount": 0,
"estimated": true,
"gasPriceGwei": 0,
"nativePriceUsd": 0,
"usd": 0
},
"existingExposure": {
"debtUsdSameMarket": 0,
"depositUsdSameMarket": 0,
"rateDeltaBp": 0,
"depositRateDeltaBp": 0,
"repriceCostPerDayUsd": 0,
"accountAprPre": 0,
"accountAprPost": 0,
"accountNavUsd": 0,
"accountNavUsdPost": 0
},
"notes": [
"string"
]
},
"flashFeeBps": 0,
"simulation": {
"pre": {
"healthFactor": 1.85,
"borrowCapacity": 3000
},
"post": {
"healthFactor": 2.1,
"borrowCapacity": 3500,
"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": {}
}
}
},
"simulationError": "string"
}