Hermes + CoinGlass + RiskState + CoW
Derivatives-informed trading agent with funding rate, open interest, and liquidation context. RiskState gates position size and leverage based on real-time market regime. CoW Swap executes with MEV protection.
Architecture
Intelligence proposes. RiskState permits. Execution acts.
How it works
CoinGlass provides market intelligence
Your agent queries CoinGlass for real-time market data — funding rates, open interest, liquidation maps, CVD, and ETF flows. Hobbyist or starter tier.
RiskState gates the decision
Before any execution, your agent calls POST /v1/risk-state. The response contains max_size_fraction (position ceiling), allowed_actions (what’s permitted), and structural_blockers (hard stops). If blockers exist, the agent halts. Otherwise, it sizes the trade within the policy limit. 30+ signals scored in real-time, 60-second cache, SHA-256 audit hash.
CoW Swap executes within limits
The trade is submitted to CoW Swap with MEV protection via batch auctions. Surplus goes to the trader, not the MEV bot. Position size never exceeds what RiskState permitted.
Integration code
Copy this into your project. Replace the API keys with your own.
import requests
# 1. Get market intelligence from CoinGlass
coinglass = requests.get(
"https://open-api-v3.coinglass.com/api/futures/funding-rate",
headers={"coinglassSecret": COINGLASS_KEY},
params={"symbol": "BTC"}
).json()
# 2. Get risk policy from RiskState
policy = requests.post(
"https://riskstate.netlify.app/v1/risk-state",
headers={"Authorization": f"Bearer {RISKSTATE_KEY}"},
json={"asset": "BTC", "include_details": True}
).json()
max_size = policy["exposure_policy"]["max_size_fraction"]
leverage_ok = policy["exposure_policy"]["leverage_allowed"]
blockers = policy["risk_flags"]["structural_blockers"]
# 3. Enforce governance before execution
if blockers:
print(f"BLOCKED: {blockers}")
elif max_size < 0.15:
print("Policy level BLOCK — reduce only")
else:
# 4. Execute via CoW Swap (MEV-protected)
trade_size = portfolio_value * max_size
cow_url = f"https://swap.cow.fi/#/1/swap/DAI/cbBTC?sellAmount={trade_size}"
print(f"Execute: {cow_url}")What your agent receives from RiskState
Every call to /v1/risk-state returns these three blocks. Your agent reads them in order.
Exposure Policy
Binding- max_size_fraction — hard ceiling
- leverage_allowed — boolean
- allowed_actions — enum list
- blocked_actions — enum list
Market Intelligence
Context- tactical_state — LEAN BULL, etc.
- market_regime — TREND, RANGE...
- binding_constraint — source + why
- risk_flags — blockers + risks
Auditability
Trust- policy_hash — SHA-256
- confidence_score — 0-100
- data_sources — per-signal
- ttl_seconds — cache hint
Start building
Get an API key in under a minute. Free during beta.
Other agent setups
OpenClaw + DeFiLlama + RiskState + Uniswap
DeFi opportunity execution
DeFi research and allocation agent. DeFiLlama provides free TVL, yield, and protocol data. RiskState enforces position limits before any deployment. Uniswap executes via UniswapX intents — gasless and MEV-protected.
ElizaOS + Nansen + RiskState + CoW
Smart-money aware execution
Wallet-tracking agent powered by the largest crypto-native framework (17K+ stars, 25+ DeFi plugins). Nansen identifies smart-money flows and sector rotations, RiskState decides how much capital is allowed, CoW executes the trade.
Hermes + CoinGlass + RiskState + Safe
Treasury risk-controlled execution
DAO or team treasury agent with multisig governance. CoinGlass provides market context, RiskState enforces policy limits, Safe Smart Account ensures multi-party execution control.
Coinbase AgentKit + RiskState + Agentic Wallet
Builder-friendly onchain agent
Fastest path to a risk-governed agent. AgentKit handles wallet creation, transaction signing, and onchain actions. Alchemy provides onchain data, token balances, and transaction history. RiskState adds the missing governance layer.