Perpetual Futures
Funding-aware leverage caps, squeeze detection, and regime-conditioned exposure governance for perpetual futures trading.
Free during beta
The problem
Using 5x leverage in a SQUEEZE regime is structurally different from 5x in a confirmed TREND. Static leverage limits ignore the market state that determines whether leverage helps or destroys.
Paying 0.03% per 8 hours sounds small until you realize it compounds to 40%+ annualized. Without funding decomposition into carry vs. directional signal, traders hold losing positions that bleed quietly.
Long BTC perps + borrow against BTC collateral creates double exposure to the same downside move. A 15% drop can trigger both liquidation and margin call simultaneously.
How it works
RiskState decomposes funding rate into carry yield and directional signal. Funding percentile (30d) and basis premium tell you whether the crowd is positioned for a squeeze. Leverage is blocked at policy levels 1-3.
6-signal classifier combining funding sign, funding percentile, basis premium, L/S crowding, liquidation imbalance, and OI z-score. Returns UPSIDE, DOWNSIDE, or TWO-SIDED with confidence percentage.
Open interest measured against 30-day history as a z-score. High OI (z > 2) with crowded positioning signals elevated liquidation risk. The policy engine tightens exposure automatically.
If you borrow stablecoins to fund margin, RiskState sees both sides. Health factor from Aave V3 or Spark feeds directly into max_size_fraction alongside derivatives positioning data.
API response
leverage_allowedBoolean — whether leverage is permitted at current policy level
max_size_fractionHard ceiling on position size, tightened by squeeze and volatility
context_risksActive warnings: HIGH_FUNDING, SQUEEZE_RISK, OI_EXTREME, TREND_NOT_CONFIRMED
structural_blockersNon-empty = halt. Hard stops like EXTREME_VOLATILITY or DATA_STALE
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.
Leverage is governed by policy level. At levels 1-2 (BLOCK), leverage is completely blocked — only reduce and hedge. At level 3 (CAUTIOUS), leverage is blocked and only R:R > 2:1 trades are allowed. At levels 4-5, leverage up to 2x is permitted. These levels are computed from 30+ real-time signals including funding rates, OI z-score, volatility regime, and DeFi health.
RiskState’s squeeze classifier combines 6 weighted signals (funding, funding percentile, basis premium, L/S crowding, liquidation imbalance, OI z-score) to detect whether shorts or longs are at risk of forced liquidation. An UPSIDE squeeze (shorts at risk) with high confidence triggers an OPPORTUNITY alert. A DOWNSIDE squeeze (longs at risk) triggers a WARNING. The policy engine factors squeeze risk into allowed actions.
Yes. RiskState decomposes the funding rate into carry yield (the cost of holding the position) and directional signal (what the rate tells you about market positioning). The annualized carry is computed and included in the detailed response. Extreme funding (90th+ percentile vs 30-day history) triggers risk flags and can tighten the policy level.
RiskState is execution-layer agnostic. Call the API before placing any perp trade — on any exchange. The response tells you max position size, whether leverage is allowed, and what actions are blocked. Your trading system reads the policy and enforces limits before sending the order. Works with any CEX or DEX perps venue.
RiskState reduces liquidation risk by governing position size and leverage before entry. If you follow the max_size_fraction and leverage_allowed limits, your effective exposure stays within what the current market conditions support. Combined with DeFi health factor integration (if you borrow to fund margin), RiskState creates a unified view of your liquidation risk across both perp and lending positions.
Free during beta. API key delivered instantly.