DeFi Borrowing
Liquidation-aware exposure governance for DeFi lending positions on Aave V3 and Spark Protocol. Health factor feeds directly into your risk permissions.
Free during beta
The problem
A health factor of 1.5 means different things in a confirmed TREND vs. a PANIC regime with -44% drawdown risk. DeFi dashboards show health factor without market context.
You borrow DAI against ETH on Aave, then trade spot with that DAI. Two separate risk surfaces — lending liquidation and trade loss — that compound on the same directional move.
Autonomous agents managing DeFi positions need hard limits. Without a governance layer, an agent can borrow to maximum LTV during a SQUEEZE regime and get liquidated within hours.
How it works
Pass your wallet address and RiskState reads your Aave V3 or Spark Protocol position on-chain. Health factor, LTV, collateral composition, and liquidation price all feed into the defi_cap — one of 4 independent risk caps that determine max_size_fraction.
RiskState reads on-chain ReserveConfigurationMap bitmaps for each collateral (WETH, WBTC, wstETH, rETH). Liquidation threshold and bonus are computed per-asset and weighted by collateral value. No hardcoded assumptions.
The policy engine computes 4 independent caps: rules (market signals), DeFi (health factor), macro (yields, liquidity), and cycle (MVRV, halving). The lowest cap wins. Your DeFi health directly limits how much new exposure you can take.
Aave V3 and Spark Protocol supported via on-chain reads through Alchemy RPC. Supports BTC, ETH, wstETH, rETH, LINK, UNI, AAVE, GHO as collateral. DAI, USDC, USDT as debt.
API response
max_size_fractionPosition limit incorporating DeFi health factor as a binding cap
binding_constraint.sourceShows DEFI when health factor is the limiting risk factor
exposure_policyCombined market + DeFi risk in one policy object
context_risksDeFi-specific warnings: LIQUIDATION_RISK, LOW_HEALTH_FACTOR
Request
curl -X POST https://riskstate.netlify.app/v1/risk-state \
-H "Authorization: Bearer $RISKSTATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"asset": "BTC"}'Response
{
"exposure_policy": {
"max_size_fraction": 0.42, // ◀
"leverage_allowed": true, // ◀
"allowed_actions": ["DCA", "LONG_SHORT_CONFIRMED"],
"blocked_actions": ["ALL_IN", "LEVERAGE_GT_2X"]
},
"tactical_state": "LEAN BULL", // ◀
"market_regime": "TREND",
"policy_level": 4,
"binding_constraint": {
"source": "MACRO", // ◀
"reason_codes": ["MACRO_NEUTRAL", "COUPLING_NORMAL"]
},
"risk_flags": {
"structural_blockers": [],
"context_risks": ["HIGH_COUPLING", "TREND_NOT_CONFIRMED"]
}
}One POST request. Deterministic policy. No ML to train, no rules to write.
Pass your wallet address in the API request. RiskState reads your Aave V3 or Spark Protocol position on-chain via Alchemy RPC — health factor, LTV, collateral amounts, and per-asset liquidation thresholds. The data is read in real-time, never stored. Health factor feeds directly into the defi_cap, which limits your max_size_fraction.
Aave V3 and Spark Protocol on Ethereum mainnet. Collaterals: WETH, WBTC, wstETH, rETH, LINK, UNI, AAVE, GHO. Debt: DAI, USDC, USDT. Per-collateral liquidation thresholds are read from on-chain ReserveConfigurationMap. wstETH/ETH exchange rate is fetched dynamically from the Lido contract.
As health factor decreases, defi_cap tightens — reducing max_size_fraction. At low health factors, the policy level drops to BLOCK and most actions are blocked. RiskState provides early warning before liquidation becomes imminent, not after. The goal is to prevent you from adding exposure when your lending position is already stressed.
RiskState governs pre-trade exposure, not post-trade position management. It prevents you from taking new positions that would increase liquidation risk. If you follow the max_size_fraction limit and respect structural_blockers, you’re less likely to add exposure during dangerous conditions. But RiskState doesn’t manage your existing DeFi position — it governs what you can do next.
Before any new trade or borrow action, call the API with your wallet address. Check binding_constraint.source — if it shows DEFI, your lending health is the limiting factor. Respect max_size_fraction for new positions. This way, your spot/perp trading is automatically constrained by your DeFi health, creating unified risk governance across both lending and trading.
Free during beta. API key delivered instantly.