Skip to main content

Collateral ⇄ debt optimizer

GET 

/v1/data/lending/pairs/optimize

Filter pairs by either or both sides, then optionally compute the opposite-side amount per row.

Asset selection​

collaterals / debts are reinterpreted by chain mode:

  • Single chain (chainId): values are token addresses.
  • Multi-chain or no chain: values are asset groups.

Use collateralGroups / debtGroups to force group semantics in any chain mode. Group params and address params on the same side are OR'd.

The native asset, and why you usually want groups​

The native asset is spelled as the zero address in every 1delta data payload. 0xEeee…EEeE is an encoding-layer sentinel — it is accepted on action inputs and normalised away, but it is never served here and never matches an address filter, so a client filtering by it silently gets zero rows.

Native and wrapped-native markets are different rows (0x0 on Fluid’s ETH vaults, 0xc02a… on Aave WETH) but share one assetGroup (ETH). Selecting by group therefore returns both — which is what you want whenever the two are interchangeable for your purpose (a migrate bridges them by wrapping, a leverage loop can open on either). It also removes any need for a per-chain wrapped-native address table in the client. Each asset also carries props.isNative + props.wrapped (native rows) and props.wnative (wrapped rows) if you need to tell them apart after the fact.

Amount params​

The collateral and debt sides are independent — supply an amount on either side, both, or neither:

  • collateralAmount (token units; requires exactly one collateral asset)
  • collateralAmountUsd (USD; multi-asset OK)
  • debtAmount (token units; requires exactly one debt asset)
  • debtAmountUsd (USD; multi-asset OK)

A collateral input adds maxDebtAmount + maxDebtAmountUsd to each row; a debt input adds minCollateralAmount + minCollateralAmountUsd. Supplying both a collateral and a debt amount returns both column pairs. Within a single side the token-unit and *Usd forms are mutually exclusive (400 otherwise). Un-openable pairs are dropped by default on BOTH legs (includeIlliquid=true keeps them). Unconditionally: a collateral leg with no remaining supply capacity (depositableLong <= 0 — a full or deliberately zeroed supply cap, where the market returns 0 for a max-deposit query). Additionally, when an amount is supplied: a debt leg whose borrow liquidity cannot fund the resulting debt, and a collateral leg whose capacity cannot absorb the required collateral. With no amount supplied, a small-but-real capacity is a real (smaller) opportunity and stays listed; depositableLong: null means uncapped and always passes.

Only loops we can open​

This is the LOOP optimizer, so it serves only pairs a loop route can open: every lender whose loop support has no open route is left out (the Compound V2 forks outside Venus, the CDPs, Teller, TermMax, and the Solana families with no loop builder — Zodial, DefiTuna, Jupiter Offerbook). includeUnbuildable=true serves them anyway, each stamped capabilities: []. /v1/data/lending/pairs/leverage is the unfiltered pair browser.

Depth-aware APR​

Whenever an amount is supplied, each row also carries the EFFECTIVE APR at the computed notional: borrowAprAtAmount, depositAprAtAmount, netAprAtAmount. Each is the headline effective rate (depositAprLong / borrowAprShort, which fold in intrinsic yield + rewards) with only its ORGANIC (IRM) component re-priced at the utilization the position moves the pool to — intrinsic + rewards are size-invariant. So a curve lender that borrows near 0% at 0 notional prices materially higher at a real size, and netAprAtAmount is comparable to aprTotal but at the position's actual size/leverage. Pass depth=true to additionally receive the raw borrowDepthShort/supplyDepthLong grids.

Credit desks​

Every row carries collateralDesk and debtDesk (see CreditDesk): the leg asset's own issuer, unless that issuer is a pure instrument wrapper (Pendle, Spectra, Exponent, or any token carrying a pendle/spectra/exponent/receipt prop) — then its fewest-hop non-instrument issuerExposures entry, with the instrument issuer as via ({ id: 'ethena', via: 'pendle', hops: 1 } on a PT-sUSDe leg; { id: 'strata', hops: 0 } on Strata's srUSDe, which is exposed to Ethena but is Strata's own token). An instrument issuer is never a desk. null when the asset names no desk. Group strategies by collateralDesk. The collateral is what you hold; the debt is only whose money you owe. A stablecoin debt is not an exposure — a USDC-funded sUSDe loop is Ethena credit, not Circle credit — so debtDesk must never be used to bucket a strategy. collateralIssuers=…&issuerMatch=credit selects exactly the rows whose collateralDesk.id is one of the ids.

Plain-text reference — GET /v1/data/lending/pairs/optimize

Parameters

ParameterInTypeRequiredDescription
includeAMMquerybooleannoInclude pairs with a Fluid smart (T2/T3/T4) vault on either leg. Excluded by default — the collateral or debt of those vaults is a two-token DEX LP; includeAMM=true opts in. Tokenized LP collateral (Lista …-SmartLP, Pendle LP) is an ordinary row and is not affected. Alias: includeAmm. The value is case-insensitive (true / 1); the parameter name is not.
chainIdquerystringnoSingle chain ID. When set, asset filters operate on token addresses. See the ChainId schema for the full set of supported chains.
chainIdsquerystringnoCSV of chain IDs. When two or more, asset filters operate on asset groups. See the ChainId schema for the full set of supported chains.
lenderquerystringnoSingle lender key See the LenderId schema for the full set of accepted values.
lendersquerystringnoCSV of lender keys (prefix-expanded) See the LenderId schema for the full set of accepted values.
excludeLendersquerystringnoCSV of lender keys to exclude (prefix-expanded)
includeUnbuildablequerystringnoAlso serve pairs on lenders no loop route can open (default false). They carry capabilities: [].
collateralsquerystringnoCSV of long-side filters. Token addresses (single chain) or asset groups (multi/no chain).
debtsquerystringnoCSV of short-side filters. Same dual semantics as collaterals.
collateralGroupsquerystringnoCSV of long-side asset groups (works in any chain mode).
debtGroupsquerystringnoCSV of short-side asset groups (works in any chain mode).
collateralTagsquerystringnoCSV of property flags the collateral (long) asset must carry, e.g. eth, btc, native, wnative, stablecoin, savings, lst, lrt, pendle, rwa. AND-ed with any collaterals/collateralGroups selection (narrows). Denomination flags (eth/btc) cover canonical base tokens only, not LST/derivative wrappers.
collateralTagsModequeryany, allnoHow to match multiple collateralTags: any (has at least one) or all (has every one).
debtTagsquerystringnoCSV of property flags the debt (short) asset must carry (e.g. eth, btc, native, wnative, stablecoin, savings, lst, lrt, pendle, rwa). Same semantics as collateralTags. Example: collateralTags=lst&debtTags=wnative for leveraged staking.
debtTagsModequeryany, allnoHow to match multiple debtTags: any or all.
collateralIssuersquerystringnoCSV of ISSUER ids the collateral (long) asset must be issued by, e.g. sky, ethena, circle, maple, lido. WHOSE CREDIT the asset is — not the money it is worth (USDe and USDC are both USD and are not the same credit), not the venue or curator that hosts it (sUSDe lent on Morpho is Ethena's credit, not Morpho's), not the chain or bridge it arrived over. OR-ed across the listed ids; there is no all mode, since an asset has at most one desk per axis. AND-ed with any collaterals/collateralGroups/collateralTags selection (narrows). Assets with no issuer (WETH, BNB, AVAX — nobody's liability) never match. Matches the asset's own desk OR its exposure desk by default (a PT over sUSDe answers to ethena); narrow with issuerMatch.
debtIssuersquerystringnoCSV of ISSUER ids the debt (short) asset must be issued by. Same semantics as collateralIssuers. Asked per LEG, never per pair: a levered row's credit exposure is its collateral's desk while the debt leg is whose dollar you owe, so collateralIssuers=ethena&debtIssuers=circle is a real and different question from either alone.
collateralAssetClassesquerystringnoCSV of asset classes the collateral (long) asset must be of: stock, etf, pre-ipo, fund, credit, commodity, or the aliases stocks / equity (stock + etf + pre-ipo) and rwa (every class). Matches collateralAssetClass. Read verbatim off token-lists props.rwa (equity/stock → stock, equity/pre-ipo → pre-ipo, fund/etf → etf, other funds → fund, credit → credit, commodity → commodity), never from a ticker. An asset with no class (crypto) never matches; an unknown value is a 400 naming the valid ones. Forwarded to the origin and applied again by the 1delta API on the stamped rows, so an origin that ignores it cannot widen the answer (the page may then come back short of count).
debtAssetClassesquerystringnoCSV of asset classes the debt (short) asset must be of; same values. Matches debtAssetClass. Asked per LEG, like debtIssuers.
collateralUnderlyingTickersquerystringnoCSV of real-world tickers the collateral must track (collateralUnderlyingTicker, case-insensitive; equity classes only). ANDed with collateralAssetClasses.
debtUnderlyingTickersquerystringnoCSV of real-world tickers the debt asset must track (debtUnderlyingTicker). ANDed with debtAssetClasses.
issuerMatchqueryany, direct, exposure, creditnoWhich desk the issuer filter matches. any (default) spans BOTH the asset's own desk and the desk its underlying resolves to — a PT over sUSDe is Pendle's INSTRUMENT and Ethena's CREDIT, so it answers to issuers=pendle and to issuers=ethena in one call, with no client-side union. direct = only that desk's own instruments. exposure = only wrappers whose underlying resolves to it. credit = only assets whose CREDIT DESK (see CreditDesk) is one of the ids: every asset has at most one, so under credit the issuers filter PARTITIONS the result (a PT-sUSDe answers to ethena and never to pendle). Applied per leg (collateralIssuers against collateralDesk, debtIssuers against debtDesk). credit is served by the 1delta API over the origin's any superset, scanning up to 20 origin pages; total is null (and truncated: true is set) when the scan stopped before the end.
includeExpiredquerybooleannoInclude pairs whose collateral or debt is an expired Pendle PT. Excluded by default (judged live off props.pendle.expiry/expired).
collateralAmountquerynumbernoToken-unit collateral amount. Requires exactly one collateral asset.
collateralAmountUsdquerynumbernoUSD collateral amount. Multi-asset selections OK.
debtAmountquerynumbernoToken-unit debt amount. Requires exactly one debt asset.
debtAmountUsdquerynumbernoUSD debt amount. Multi-asset selections OK.
depthquerybooleannoWhen true, also return the raw borrowDepthShort/supplyDepthLong rate-at-depth grids. The *AtAmount depth-aware scalars are returned whenever an amount is supplied, regardless of this flag.
includeIlliquidquerybooleannoBy default the optimizer drops collateral legs with no remaining supply capacity, and — when an amount is supplied — pairs whose borrow liquidity cannot fund the resulting debt or whose collateral capacity cannot absorb the required collateral. Set true to keep such (un-openable) pairs.
minAprquerynumbernoMinimum total APR
maxAprquerynumbernoMaximum total APR
minLeveragequerynumbernoMinimum leverage
minDepositAprquerynumbernoMin deposit APR including intrinsic yield (long side)
maxBorrowRatequerynumbernoMax borrow rate including intrinsic yield (short side)
minLtvquerynumbernoMinimum LTV (0-1)
maxUtilizationLongquerynumbernoMax collateral-side utilization (0-1)
maxUtilizationShortquerynumbernoMax debt-side utilization (0-1)
minLiquidityUsdLongquerynumbernoMin collateral-side liquidity USD. This is withdrawable CASH in the market, NOT deposit capacity — capacity is gated separately (see includeIlliquid).
minBorrowLiquidityUsdquerynumbernoMin debt-side borrow liquidity USD
minDepositsUsdLongquerynumbernoMin collateral-side deposits USD
minDebtUsdShortquerynumbernoMin debt-side total debt USD
maxRiskScorequerynumbernoBackwards-compat alias for maxConfigRiskScore; ignored when maxConfigRiskScore is set.
maxConfigRiskScorequerynumbernoMax config risk score (1–5; 6 = compromised — a config that accepts a compromised collateral asset). Default 4 never admits a 6. The config score is the highest of chain, lender and EVERY asset active in the pair's config — for a collateral, its oracle score too — so on a pooled or cross-margin lender one risky collateral raises every pair in that config, including pairs that do not use it. Takes precedence over maxRiskScore. Pass 6 to receive everything and filter on risk.breakdown client-side.
maxTokenRiskScorequerynumbernoMax token risk score
maxChainRiskScorequerynumbernoMax chain risk score
maxLenderRiskScorequerynumbernoMax lender risk score
startqueryintegernoPagination offset
countqueryintegernoPage size (max 100)
sortByqueryaprTotal, aprBase, maxLeverage, ltv, depositAprLong, borrowAprShort, … (15 values)noSort field
sortDirqueryASC, DESCnoSort direction

Response 200

FieldTypeDescription
successTrue
dataobject
data.chainIdsstring[]EVM chain ids, as decimal strings. See the ChainId schema.
data.collateralsstring[]
data.debtsstring[]
data.collateralAmountnumber
data.collateralAmountUsdnumber
data.debtAmountnumber
data.debtAmountUsdnumber
data.startinteger
data.countintegerNumber of entries in items.
data.itemsobject[]The result set for this response.
data.items[].chainIdstringEVM chain id, as a decimal string. See the ChainId schema.
data.items[].lenderstringProtocol identifier. See the LenderId schema.
data.items[].fixedTermobjectFixed-term descriptor for this pair's lender, joined by lender key. Absent on variable-rate lenders. For Term Finance (model: "term"), gate the borrow/loop CTA on fixedTerm.auction.canBorrow: origination only happens inside scheduled sealed-bid auction rounds and most repos sit between rounds, so a pair can carry a maturity, an LTV and a rate and still be impossible to borrow. While a repo has no rate card (between rounds) termsShort is empty, borrowAprShort is null and aprBase/aprTotal still carry the 0%-debt figure — show them as indicative, not obtainable, whenever canBorrow is false. With a card present the borrow leg is priced off it (see borrowAprShort).
data.items[].marketLongUidstringMarket UID of the collateral side
data.items[].marketShortUidstringMarket UID of the debt side
data.items[].marketNameLongstringDisplay name of the collateral market/vault (e.g. the Euler eVault name). Disambiguates rows that share the collateral/debt token symbols and lender.
data.items[].marketNameShortstringDisplay name of the debt market/vault. For Euler this is the controller (debt) eVault — the primary way to tell otherwise-identical WETH→USDC rows apart.
data.items[].curatorNameLongstringCurator/brand of the collateral market (Euler: resolved from the vault governor). Null for lenders without a curator, or until the curator registry is seeded. Render as "curatorName + symbol", falling back to marketNameLong.
data.items[].curatorNameShortstringCurator/brand of the debt (controller) market. Same semantics as curatorNameLong.
data.items[].assetLongstring
data.items[].assetShortstring
data.items[].assetGroupLongstring
data.items[].assetGroupShortstring
data.items[].symbolLongstringCollateral token symbol
data.items[].nameLongstringCollateral token name
data.items[].symbolShortstringDebt token symbol
data.items[].nameShortstringDebt token name
data.items[].aprBasenumberLeverage-weighted net APR % EXCLUDING rewards — the SUSTAINABLE rate (reward incentives are typically transient). Re-priced off the best fixed term on brokered debt markets, like aprTotal.
data.items[].aprTotalnumberLeverage-weighted net APR % at max leverage INCLUDING rewards. The reward contribution is aprTotal − aprBase. On a brokered (fixed-term) debt market the borrow leg is the best fixed term (see borrowAprShort), so a fixed-term pair sorts and filters (minApr/maxApr, sortBy=aprTotal) by the rate it actually borrows at — never by the 0% variable leg.
data.items[].maxLeveragenumberHighest leverage multiple reachable in this market.
data.items[].ltvnumberLoan-to-value ratio, as a fraction between 0 and 1.
data.items[].depositAprLongnumberEffective deposit APR (depositRate + intrinsicYield)
data.items[].borrowAprShortnumberEffective borrow APR % on the debt side (+ intrinsicYieldShort − rewardAprShort, plus any 1y-amortized origination fee — see originationFeeShort). On a BROKERED (fixed-term only) debt market — variableBorrowDisabledShort=true: Lista broker, Morpho Midnight book, Term Finance repo, TermMax, Teller — the variable rate is 0 and meaningless, so this is the BEST (lowest) fixed term from termsShort (the figure the lender publishes as stableBorrowRate). Null only when the market is brokered AND has no rate card right now (a Term Finance repo between auctions — read fixedTerm.auction). For Liquity-family CDPs the amortized origination fee is the whole borrow cost (variable rate is 0).
data.items[].intrinsicYieldLongnumberStandalone intrinsic yield % of the collateral asset (already folded into depositAprLong).
data.items[].intrinsicYieldShortnumberStandalone intrinsic yield % of the debt asset (already folded into borrowAprShort). termsShort[].apr / aprAtAmount carry NO intrinsic or reward component — add this and subtract rewardAprShort to put a raw term on the same footing as borrowAprShort.
data.items[].variableBorrowDisabledShortbooleanTrue when the debt (short) market is BROKERED — fixed-term only, no variable borrow through the composer (Lista broker, Morpho Midnight book, Term Finance repo, TermMax, Teller). borrowAprShort is then the best fixed term from termsShort (null with no card), aprBase/aprTotal are re-priced off it, and each termsShort entry is its own loop option with its own maturity.
data.items[].termsShortobject[]Fixed-term rate card on the debt (short) side. Each entry is one loop option; apr is the raw term rate in PERCENT (no intrinsic / reward — see intrinsicYieldShort). When an amount is supplied, order-book terms (Morpho Midnight) also carry aprAtAmount (size-weighted VWAP), fillable and capped. Null/empty on variable-rate pairs. For Term Finance an empty card means "not borrowable right now" — read fixedTerm.auction.
data.items[].termsShort[].termIdintegerTerm identifier — MEANING IS LENDER-SPECIFIC. Exactly and TermMax: the pool/market unix MATURITY timestamp. Lista: the broker-defined product id. Teller: the duration in seconds (rolling term). Midnight and Term Finance: 0, a placeholder (single maturity per market, so the id carries no information). Pass to /v1/actions/lending/borrow?termId=…. Numeric on-chain; some upstream feeds serialize it as a string — coerce with Number() when comparing.

Example response

{
"success": true,
"data": {
"chainIds": [
"1"
],
"collaterals": [
"string"
],
"debts": [
"string"
],
"collateralAmount": 1.0,
"collateralAmountUsd": 1.0,
"debtAmount": 1.0,
"debtAmountUsd": 1.0,
"start": 1,
"count": 1,
"items": [
{
"chainId": "1",
"lender": "AAVE_V3",
"fixedTerm": {
"model": "term",
"maturity": 1,
"fees": {},
"earlyRepay": {},
"provider": {},
"auction": {
"status": "open",
"canBorrow": true,
"canLend": true,
"secondsUntilClose": 263000,
"implications": [
"string"
],
"id": "string",
"startTime": 1,
"revealTime": 1,
"endTime": 1,
"minBorrowAmount": "1000000000",
"minLendAmount": "1000000000"
}
},
"marketLongUid": "string",
"marketShortUid": "string",
"marketNameLong": "string",
"marketNameShort": "string",
"curatorNameLong": "string",
"curatorNameShort": "string",
"assetLong": "string",
"assetShort": "string",
"assetGroupLong": "string",
"assetGroupShort": "string",
"symbolLong": "string",
"nameLong": "string",
"symbolShort": "string",
"nameShort": "string",
"aprBase": 1.0,
"aprTotal": 1.0,
"maxLeverage": 1.0,
"ltv": 1.0,
"depositAprLong": 1.0,
"borrowAprShort": 1.0,
"intrinsicYieldLong": 1.0,
"intrinsicYieldShort": 1.0,
"variableBorrowDisabledShort": true,
"termsShort": [
{
"termId": 2,
"depositApr": 1.0,
"available": 1.0,
"durationDays": 7,
"durationSecs": 604800,
"apr": 3.85,
"aprAtAmount": 1.0,
"fillable": 1.0,
"capped": true,
"ladder": [
{
"apr": 1.0,
"units": "string",
"assets": 1.0
}
]
}
],
"originationFeeShort": 1.0,
"totalDepositsUsdLong": 1.0,
"totalDepositsUsdShort": 1.0,
"totalDebtUsdLong": 1.0,
"totalDebtUsdShort": 1.0,
"totalLiquidityUsdLong": 1.0,
"totalLiquidityUsdShort": 1.0,
"borrowLiquidityShort": 1.0,
"utilizationLong": 1.0,
"utilizationShort": 1.0,
"maxDebtAmount": 1.0,
"maxDebtAmountUsd": 1.0,
"minCollateralAmount": 1.0,
"minCollateralAmountUsd": 1.0,
"borrowAprAtAmount": 1.0,
"depositAprAtAmount": 1.0,
"netAprAtAmount": 1.0,
"netAprAtAmountBase": 1.0,
"borrowDepthShort": {},
"supplyDepthLong": {},
"risk": {
"maxTokenScore": 1,
"breakdown": [
{
"category": "lender",
"score": 1,
"label": "low",
"curatorIds": [
"string"
]
}
]
},
"collateralDesk": {
"id": "ethena",
"name": "Ethena",
"kind": "string",
"via": "pendle",
"hops": 1
},
"debtDesk": {
"id": "ethena",
"name": "Ethena",
"kind": "string",
"via": "pendle",
"hops": 1
},
"collateralAssetClass": "stock",
"debtAssetClass": "stock",
"collateralUnderlyingTicker": "string",
"debtUnderlyingTicker": "string"
}
]
}
}

Request​

Responses​

Optimizer pairs