Skip to content

likidodefi/riskstate-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RiskState

RiskState

Risk governance API for autonomous crypto trading agents

API Version Status Assets Pricing

Website · API Reference · SKILL.md · X/Twitter


What is RiskState?

A deterministic policy engine that tells AI trading agents how much risk is allowed — not what to trade.

One API call returns position limits, allowed actions, and policy constraints computed from 30+ real-time signals across macro, on-chain, derivatives, and DeFi health.

curl -X POST https://riskstate.netlify.app/v1/risk-state \
  -H "Authorization: Bearer $RISKSTATE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asset": "BTC"}'
{
  "exposure_policy": {
    "max_size_fraction": 0.42,
    "leverage_allowed": true,
    "allowed_actions": ["DCA", "LONG_SHORT_CONFIRMED"],
    "blocked_actions": ["ALL_IN", "LEVERAGE_GT_2X"]
  },
  "policy_level": 4,
  "risk_flags": {
    "structural_blockers": [],
    "context_risks": ["HIGH_COUPLING"]
  },
  "binding_constraint": {
    "source": "MACRO",
    "reason_codes": ["MACRO_NEUTRAL", "COUPLING_NORMAL"]
  }
}

Your agent reads max_size_fraction, checks structural_blockers, and acts. No parsing. No interpretation.

Why?

Autonomous trading agents can execute trades. None of them know when to stop.

Without governance With RiskState
Agent sizes position based on signal confidence Agent caps position at max_size_fraction
No awareness of macro regime RISK-OFFblocked_actions: ["AGGRESSIVE_LONG"]
DeFi health factor ignored Wallet health feeds directly into position limit
Leverage unbounded max_leverage: "1x" enforced per policy level
No circuit breaker structural_blockers non-empty → halt

Quick Start

1. Get an API key

Sign up at riskstate.ai — email only, free during beta.

2. Query the API

curl -X POST https://riskstate.netlify.app/v1/risk-state \
  -H "Authorization: Bearer $RISKSTATE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asset": "BTC"}'

3. Enforce in your agent

import requests

policy = requests.post(
    "https://riskstate.netlify.app/v1/risk-state",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={"asset": "BTC"}
).json()

# Hard stop: structural blockers
if policy["risk_flags"]["structural_blockers"]:
    return  # Do not trade

# Size cap
max_size = policy["exposure_policy"]["max_size_fraction"]
position_size = min(desired_size, portfolio_value * max_size)

# Action filter
if "LEVERAGE" in policy["exposure_policy"]["blocked_actions"]:
    leverage = 1.0

Policy Levels

Level Label Max Size What your agent can do
1 BLOCK Survival <15% Reduce exposure, hedge only
2 BLOCK Defensive <35% Wait, hedge, small scalps
3 CAUTIOUS <60% DCA, R:R >2:1 only
4 GREEN Selective <80% Trade with confirmation
5 GREEN Expansion ≥80% Full operations, leverage up to 2x

Supported Assets

  • BTC — Full signal coverage (30+ indicators)
  • ETH — Full coverage including ETH structural score, ETH/BTC ratio analysis, staking dynamics

Integration Paths

REST API

Direct HTTP calls. Any language, any framework.

SKILL.md

Drop SKILL.md into your agent's repo. Compatible with Claude Code, Copilot, Cursor, and Gemini via skills.sh.

MCP Server

npm install @riskstate/mcp-server

Or run directly with npx @riskstate/mcp-server. Docker: ghcr.io/likidodefi/riskstate-mcp.

One tool: get_risk_policy — same parameters as the REST API. Compatible with Claude Desktop, Claude Code, Cursor, and any MCP-compatible client. See MCP README for full setup.

Listed On

Binding Precedence

When consuming the response, agents must evaluate fields in this order:

  1. risk_flags.structural_blockers — if non-empty, abort new entries
  2. exposure_policy.blocked_actions — actions the agent must not take
  3. exposure_policy.reduce_recommended — reduce exposure if true
  4. exposure_policy.max_size_fraction — maximum position size (0.0–1.0)
  5. exposure_policy.max_leverage — maximum leverage allowed

Data Sources

RiskState ingests 30+ real-time signals from:

  • Price & Derivatives — Binance, OKX, Bybit (funding, OI, basis, L/S ratio)
  • On-chain — MVRV, NUPL, exchange netflow, supply metrics (CoinGlass)
  • Macro — DXY, US yields, S&P 500, Gold, Fed balance sheet (FRED, Yahoo Finance)
  • DeFi — Spark Protocol, Aave V3 health factor and liquidation thresholds
  • Sentiment — Fear & Greed, ETF flows, institutional treasuries
  • ETH-specific — Staking ratio, burn rate, DEX volume, fees, stablecoin TVL

Pricing

Free during beta. Rate limit: 60 requests/minute.

Tier Calls/month Price
Free 100 $0
Builder 5,000 $49/mo
Growth 25,000 $149/mo
Scale 100,000 $399/mo

Paid tiers coming after beta. Sign up now to lock in early access.

Documentation

  • API Reference — Full endpoint documentation, field types, error codes
  • SKILL.md — Agent discovery file with decision rules and failure modes
  • Changelog — Version history and release notes
  • Website — Landing page with interactive examples

Links


Built by likidodefi · © 2026 Digital Venture Asset LLC

Releases

No releases published

Packages

 
 
 

Contributors