# OpenDepth — Complete Single-File Reference for LLMs & AI Agents (`llms-full.txt`) > Generated on 2026-12-06. Canonical web origin: https://opendepth.io · API origin: https://api.opendepth.io > OpenAPI 3.1: https://api.opendepth.io/openapi.json · MCP Server: https://api.opendepth.io/api/mcp · Manifest: https://opendepth.io/.well-known/mcp.json > Official channels: X https://x.com/opendepth_io · Telegram https://t.me/opendepth_io_bot · GitHub https://github.com/opendepth-io · Contact operation@opendepth.io --- ## Part 1: Compact Capability Index (`llms.txt`) # OpenDepth > Multi-venue CEX & Perp DEX crypto microstructure terminal, whale anomaly radar, cross-venue carry matrix, aligned backtesting, dry-run/live strategy execution (100% production mainnet data, zero exchange testnet/demo), alerts, and native MCP server across leading CEXs & Perp DEXs (Binance, OKX, Bybit, Bitget, Hyperliquid, Aster, and continuously expanding) — 6,000+ perpetual and spot markets, 1-minute bars aggregated from raw trades + 1-second time-weighted order books, 75 strategy fields, 33 indicators, and 12 timeframes (1m to 1w), including delisted contracts to eliminate survivorship bias. An AI agent can connect directly via MCP or REST with one scoped API key, pay for Plus ($19/mo) or Pro ($49/mo) with gasless x402 v2 USDC or deposited balance, write/backtest/sweep strategies, manage execution, and configure Telegram/webhook alerts. Base URL: https://api.opendepth.io MCP Server (JSON-RPC 2.0): `POST https://api.opendepth.io/api/mcp` (discovery: `GET https://api.opendepth.io/api/mcp` or `https://opendepth.io/.well-known/mcp.json`) OpenAPI 3.1 Spec: `GET https://api.opendepth.io/openapi.json` Auth: `Authorization: Bearer odk_...` (scoped API key created at https://opendepth.io → Profile → API keys). Public market data, orderbook depth, whale radar, carry matrix, macro calendar, and 4 public MCP tools require no key. Conventions: - Public market intelligence: prefer edge-cached `GET` endpoints (`/api/kline?format=compact`, `/api/kline-depth`, `/api/tokens`, `/api/market/radar`, `/api/market/carry`, `/api/macro/calendar`) accelerated by Cloudflare Smart Tiered Cache. - Authenticated account/strategy/alert actions: `POST /api//` with a JSON body; errors return `{"error":{"code","message","requestId",...}}`. ## Guides & Documentation - [Complete single-file LLM context](https://opendepth.io/llms-full.txt): combined guide, MCP tool schemas, and 75-field / 33-indicator reference. - [AI agent guide (English)](https://opendepth.io/ai-guide.md): MCP setup, public cached GET APIs, authentication, scopes, x402 membership purchase, strategies, backtests, sweeps, execution, alerts, errors. - [AI 接入指南(中文)](https://opendepth.io/ai-guide.zh.md): 同一份指南的完整中文版。 - [Human docs & quick workflow](https://opendepth.io/docs) ([Markdown](https://opendepth.io/docs.md) · [中文](https://opendepth.io/zh/docs)) - [CEX & Perp DEX Coverage Hub](https://opendepth.io/exchanges) ([Markdown](https://opendepth.io/exchanges.md) · [中文](https://opendepth.io/zh/exchanges)): Binance, OKX, Bybit, Bitget, Hyperliquid, Aster & expanding. - [Data & Backtest Methodology](https://opendepth.io/docs/methodology) ([Markdown](https://opendepth.io/docs/methodology.md) · [中文](https://opendepth.io/zh/docs/methodology)) - [75 Microstructure Fields & 33 Indicators Dictionary](https://opendepth.io/docs/indicators) ([Markdown](https://opendepth.io/docs/indicators.md) · [中文](https://opendepth.io/zh/docs/indicators)) - [MCP Server & Public API Setup](https://opendepth.io/docs/mcp) ([Markdown](https://opendepth.io/docs/mcp.md) · [中文](https://opendepth.io/zh/docs/mcp)) - [Whale Anomaly Radar Guide](https://opendepth.io/docs/whale-radar) ([Markdown](https://opendepth.io/docs/whale-radar.md) · [中文](https://opendepth.io/zh/docs/whale-radar)) - [Cross-Venue Carry Matrix Guide](https://opendepth.io/docs/carry-matrix) ([Markdown](https://opendepth.io/docs/carry-matrix.md) · [中文](https://opendepth.io/zh/docs/carry-matrix)) - [Microstructure Research Notes](https://opendepth.io/docs/research) ([Markdown](https://opendepth.io/docs/research.md) · [中文](https://opendepth.io/zh/docs/research)) - [Membership & Pricing ($0 / $19 / $49)](https://opendepth.io/pricing) ([Markdown](https://opendepth.io/pricing.md) · [中文](https://opendepth.io/zh/pricing)) - [Non-Custodial Security Architecture](https://opendepth.io/security) ([Markdown](https://opendepth.io/security.md) · [中文](https://opendepth.io/zh/security)) - [Changelog RSS Feed](https://opendepth.io/changelog/rss.xml) ## MCP Server (8 Tools) Endpoint: `POST https://api.opendepth.io/api/mcp` (`initialize`, `ping`, `tools/list`, `tools/call`) - Public (no API key required): `list_markets`, `get_microstructure_klines`, `scan_anomaly_radar`, `get_carry_matrix` - Authenticated (`Authorization: Bearer odk_...`): `list_strategies`, `create_strategy`, `compile_ai_strategy`, `get_portfolio_overview` ## Quick API Reference - Public market data (edge-cached GET, no key): - Markets & delisted lifecycle: `GET /api/tokens?token=BTC` (or `/api/tokens` for full multi-venue CEX & Perp DEX catalog) - Microstructure klines (columnar compact): `GET /api/kline?exchange=binance&marketId=binance:perp:BTC:USDT&interval=15m&limit=300&format=compact` (add `&withFeatures=1` for rolling flow Z-scores, Kyle's lambda, absorption, refill time, basis; response also surfaces `delisted`, `lifecycle`, `delistedAt`, `lastTradeAt`) - Time-weighted orderbook depth: `GET /api/kline-depth?exchange=binance&marketId=binance:perp:BTC:USDT&interval=15m&limit=300&format=compact` - Whale Anomaly Radar: `GET /api/market/radar?preset=all&quadrant=all&limit=60` - Cross-Venue Carry Matrix: `GET /api/market/carry?strategyType=all&limit=60` - Macro Economic Calendar: `GET /api/macro/calendar` - Plans, balance & gasless x402 v2 billing (`billing` scope): - `POST /api/account/plan`, `POST /api/account/balance`, `POST /api/account/plan/quote` - Pay with x402 v2 (USDC on Base, Arbitrum, Optimism, or Ethereum; EIP-3009 signature only, no gas): `POST /api/account/plan/x402 {"plan":"plus","months":1}` or `POST /api/account/balance/x402 {"amountCents":2000}` - Or deposit (`POST /api/account/deposit/address`, `POST /api/account/deposit/check`) and purchase idempotently with `POST /api/account/plan/purchase {"plan":"plus","months":1,"requestKey":""}` - Strategies, backtests & execution (`strategies` scope): - Vocabulary (75 fields, 33 indicators, 12 timeframes, operators): `POST /api/account/strategies/schema` - CRUD: `/api/account/strategies/list|get|create|set|remove` - Aligned backtest & 5×5 parameter sweep: `POST /api/account/strategies/backtest`, `POST /api/account/strategies/backtest-result`, `POST /api/account/strategies/sweep` - Dry-run/semi-auto/live strategy execution & portfolio risk guard: `/api/account/strategies/execution/get|set|list|confirm|skip`, `/api/account/strategies/portfolio-overview`, `/api/account/strategies/portfolio-guard/get|set|reset-halt` - Alerts & scheduled digests (`alerts` scope): - Channels & Telegram link: `/api/alerts/channels/list|create|enable|remove`, `POST /api/alerts/telegram/link`, `/api/alerts/digest/get|set|test` - Strategy signal routing: `/api/alerts/strategy-routing/get|set` - Price, pct_move, OI, funding & basis alerts: `/api/alerts/price/list|create|set|remove` ## Official Links - Website: https://opendepth.io - X (Twitter): https://x.com/opendepth_io - Telegram Bot: https://t.me/opendepth_io_bot - GitHub: https://github.com/opendepth-io - Contact: operation@opendepth.io --- ## Part 2: Connected CEX & Perp DEX Venues (Continuously Expanding) | Venue | Category | Markets | Funding Cadence | Sample Market ID | | --- | --- | --- | --- | --- | | Binance | CEX | Perpetual & Spot | 8h (4h on select contracts) | `binance:perp:BTC:USDT` | | OKX | CEX | Perpetual & Spot | 8h | `okx:perp:BTC:USDT` | | Bybit | CEX | Perpetual & Spot | 8h (1h/4h on select contracts) | `bybit:perp:BTC:USDT` | | Bitget | CEX | Perpetual & Spot | 8h (4h on select contracts) | `bitget:perp:BTC:USDT` | | Hyperliquid | Perp DEX | On-Chain Perp & Spot CLOB | 1h continuous | `hyperliquid:perp:BTC:USDC` | | Aster | Perp DEX | Perpetual DEX | 1h / 8h per contract | `aster:perp:BTC:USDT` | --- ## Part 3: Complete Strategy Field Dictionary (75 Fields) | Field ID | Group | Kind | Depth Gate | Formula | Description | | --- | --- | --- | --- | --- | --- | | `open` | price | stored | — | — | First raw trade execution price inside the bar. | | `high` | price | stored | — | — | Highest raw trade execution price inside the bar. | | `low` | price | stored | — | — | Lowest raw trade execution price inside the bar. | | `close` | price | stored | — | — | Final raw trade execution price inside the bar. | | `close_location` | price | derived | — | `(close - low) / (high - low)` | Range-normalized close in [0, 1]; 1 closes at the high, 0 at the low. | | `upper_wick_pct` | price | derived | — | `(high - max(open, close)) / close * 100` | Upper rejection shadow as a percentage of close. | | `lower_wick_pct` | price | derived | — | `(min(open, close) - low) / close * 100` | Lower demand tail as a percentage of close. | | `wick_asymmetry` | price | derived | — | `lower_wick_pct - upper_wick_pct` | Positive values indicate stronger lower needle rejection than upper exhaustion. | | `body_to_range` | price | derived | — | `(close - open) / (high - low)` | Signed directional conviction in [-1, 1]. | | `base_amount` | volume | stored | — | — | Total traded base asset units aggregated from raw fills. | | `quote_amount` | volume | stored | — | — | Total notional volume in quote currency (USDT/USDC). | | `taker_buy_amt` | flow | stored | — | — | Aggressive market-buy volume in base units. | | `taker_sell_amt` | flow | stored | — | — | Aggressive market-sell volume in base units. | | `taker_buy_quote` | flow | stored | — | — | Aggressive market-buy notional in quote currency. | | `taker_sell_quote` | flow | stored | — | — | Aggressive market-sell notional in quote currency. | | `taker_buy_cnt` | flow | stored | — | — | Number of aggressive buy trades inside the bar. | | `taker_sell_cnt` | flow | stored | — | — | Number of aggressive sell trades inside the bar. | | `netz_60` | flow | stored | — | — | Rolling 60-minute net taker flow normalized by historical standard deviation (σ). | | `netz_240` | flow | stored | — | — | Rolling 4-hour perpetual net taker flow Z-score. | | `netz_1440` | flow | stored | — | — | Rolling 24-hour perpetual net taker flow Z-score. | | `spotz_60` | flow | stored | — | — | Rolling 60-minute net taker flow Z-score on the paired spot twin. | | `spotz_240` | flow | stored | — | — | Rolling 4-hour paired spot net taker flow Z-score. | | `spotz_1440` | flow | stored | — | — | Rolling 24-hour paired spot net taker flow Z-score. | | `taker_imbalance` | flow | derived | — | `(buy_amt - sell_amt) / (buy_amt + sell_amt)` | Normalized buy/sell dominance in [-1, 1]. | | `taker_net_quote` | flow | derived | — | `taker_buy_quote - taker_sell_quote` | Signed quote-currency delta between taker buys and sells. | | `avg_buy_quote` | flow | derived | — | `taker_buy_quote / taker_buy_cnt` | Average notional size per aggressive buy fill. | | `avg_sell_quote` | flow | derived | — | `taker_sell_quote / taker_sell_cnt` | Average notional size per aggressive sell fill. | | `trade_size_imbalance` | flow | derived | — | `(avg_buy - avg_sell) / (avg_buy + avg_sell)` | Compares average buy ticket size against average sell ticket size in [-1, 1]. | | `perp_spot_flow_div_60` | flow | derived | — | `netz_60 - spotz_60` | >0 signals leveraged perp chasing; <0 signals healthier spot-led accumulation. | | `oi_base` | positioning | stored | — | — | Point-in-time perpetual open interest in base units. | | `oi_quote` | positioning | stored | — | — | Perpetual open interest notional in quote currency. | | `liq_long_quote` | positioning | stored | — | — | Summed forced long liquidation notional inside the bar. | | `liq_short_quote` | positioning | stored | — | — | Summed forced short liquidation notional inside the bar. | | `top_pos_lsr` | positioning | stored | — | — | Exchange top-trader net position long/short ratio (carried forward within 2h). | | `top_acct_lsr` | positioning | stored | — | — | Ratio of net-long to net-short accounts among top traders. | | `global_lsr` | positioning | stored | — | — | Crowd/retail net-long vs net-short account ratio across all traders. | | `taker_ls` | positioning | stored | — | — | Venue-reported 5m taker buy/sell volume ratio. | | `smart_dumb_div` | positioning | derived | — | `top_pos_lsr / global_lsr` | Measures how strongly top-trader positions diverge from retail accounts. | | `whale_size_skew` | positioning | derived | — | `top_pos_lsr / top_acct_lsr` | Separates largest capital whales from smaller accounts inside the top tier. | | `turnover_oi_ratio` | positioning | derived | — | `quote_amount / oi_quote` | Trading volume intensity relative to standing open interest. | | `oi_to_bid100` | positioning | derived | ±100 bps | `oi_quote / book_bid_depth_100` | High ratios highlight thin-book squeeze or liquidation cascade risk. | | `liq_imbalance` | positioning | derived | — | `(liq_short - liq_long) / (liq_short + liq_long)` | >0 short-squeeze liquidations; <0 long cascade liquidations. | | `liq_to_vol` | positioning | derived | — | `(liq_long + liq_short) / quote_amount` | Share of bar volume driven by forced liquidations. | | `funding_rate` | funding | stored | — | — | Current perpetual funding rate decimal (e.g. 0.0001 = 0.01%). | | `fr_max` | funding | stored | — | — | Peak funding rate sampled inside the bar. | | `fr_min` | funding | stored | — | — | Lowest funding rate sampled inside the bar. | | `fr_range_bps` | funding | derived | — | `(fr_max - fr_min) * 10000` | Intra-bar funding swing in basis points. | | `mark_price` | basis | stored | — | — | Exchange mark price used for unrealized PnL and liquidation. | | `index_price` | basis | stored | — | — | Composite underlying spot index price. | | `basis_60` | basis | stored | — | — | 60-minute rolling mean perp-vs-spot premium in bps. | | `basis_240` | basis | stored | — | — | 4-hour rolling mean perp-vs-spot premium in bps. | | `basis_bps` | basis | derived | — | `(mark_price - index_price) / index_price * 10000` | Instantaneous mark-minus-index spread in basis points. | | `book_spread_bps` | liquidity | stored | — | — | Time-weighted best-ask minus best-bid spread in basis points. | | `book_bid_depth_20` | liquidity | stored | ±20 bps | — | Time-weighted resting bid notional within 0.20% of mid price. | | `book_ask_depth_20` | liquidity | stored | ±20 bps | — | Time-weighted resting ask notional within 0.20% of mid price. | | `book_bid_depth_100` | liquidity | stored | ±100 bps | — | Time-weighted resting bid notional within 1% of mid price. | | `book_ask_depth_100` | liquidity | stored | ±100 bps | — | Time-weighted resting ask notional within 1% of mid price. | | `book_bid_depth_200` | liquidity | stored | ±200 bps | — | Time-weighted resting bid notional within 2% of mid price. | | `book_ask_depth_200` | liquidity | stored | ±200 bps | — | Time-weighted resting ask notional within 2% of mid price. | | `book_bid_depth_500` | liquidity | stored | ±500 bps | — | Time-weighted resting bid notional within 5% of mid price. | | `book_ask_depth_500` | liquidity | stored | ±500 bps | — | Time-weighted resting ask notional within 5% of mid price. | | `book_depth_imbalance_20` | liquidity | stored | ±20 bps | — | Near-touch bid vs ask resting depth imbalance in [-1, 1]. | | `book_depth_imbalance_100` | liquidity | stored | ±100 bps | — | 1% band bid vs ask resting depth imbalance in [-1, 1]. | | `absorb_60` | liquidity | stored | — | — | Measures how much aggressive sell volume is absorbed by resting bids without price collapse. | | `refill_min` | liquidity | stored | — | — | Minutes taken for depleted near-book bid liquidity to replenish. | | `sym_60` | liquidity | stored | — | — | 60-minute rolling depth symmetry/skew score. | | `sym_240` | liquidity | stored | — | — | 4-hour rolling depth symmetry/skew score. | | `depth_convexity_500_20` | liquidity | derived | ±500 bps | `book_bid_depth_500 / book_bid_depth_20` | Distinguishes deep passive accumulation walls from thin top-of-book liquidity. | | `book_impact_buy_bps_t1` | impact | stored | ±20 bps | — | Realized sweep slippage in bps for a tier-1 market buy against the live order book. | | `book_impact_sell_bps_t1` | impact | stored | ±20 bps | — | Realized sweep slippage in bps for a tier-1 market sell against the live order book. | | `lam_buy_60` | impact | stored | — | — | Price impact per unit of aggressive buy flow over 60 minutes. | | `lam_buy_240` | impact | stored | — | — | Price impact per unit of aggressive buy flow over 4 hours. | | `lam_sell_60` | impact | stored | — | — | Price impact per unit of aggressive sell flow over 60 minutes. | | `lam_sell_240` | impact | stored | — | — | Price impact per unit of aggressive sell flow over 4 hours. | | `impact_asymmetry_60` | impact | derived | — | `(lam_buy_60 - lam_sell_60) / (lam_buy_60 + lam_sell_60)` | >0 means upside moves more easily than downside (strong resting bid floor). | --- ## Part 4: Complete Quantitative Indicator Reference (33 Indicators) | Indicator ID | Category | Parameters | Name | Description | | --- | --- | --- | --- | --- | | `sma` | ma | `field, length` | Simple Moving Average | Arithmetic mean over `length` bars on any of the 75 fields. | | `ema` | ma | `field, length` | Exponential Moving Average | SMA-seeded recursive EMA with automatic convergence warmup matching live and backtest. | | `wma` | ma | `field, length` | Weighted Moving Average | Linearly weighted moving average emphasizing recent bars. | | `vwap` | ma | `window` | Rolling VWAP | Exact `sum(quote_amount) / sum(base_amount)` — no typical-price shortcut. | | `avwap_oi` | ma | `surgePct, lookback` | OI-Surge Anchored VWAP | Anchors VWAP automatically to the latest open-interest surge bar. | | `avg` | window | `field, window` | Rolling Mean | Window average on any field. | | `sum` | window | `field, window` | Rolling Sum | Cumulative window sum (e.g., 24h liquidation total). | | `max` | window | `field, window` | Rolling Max | Highest value over `window` bars. | | `min` | window | `field, window` | Rolling Min | Lowest value over `window` bars. | | `above_low_pct` | window | `field, window` | % Above Window Low | Percent rally off the rolling `window` minimum. | | `below_high_pct` | window | `field, window` | % Below Window High | Percent drawdown from the rolling `window` maximum. | | `stddev` | window | `field, window` | Rolling Std Dev | Window standard deviation on any field. | | `change_pct` | window | `field, lookback` | Percent Change | Percentage change versus `lookback` bars ago. | | `zscore` | window | `field, window` | Rolling Z-Score | Standard deviations from rolling mean — ideal for OI, depth, or funding anomalies. | | `rank_pct` | window | `field, window` | Percentile Rank % | Non-parametric percentile rank in [0, 100] over `window` bars. | | `rsi` | oscillator | `field, length` | Wilder's RSI | Exact Wilder recursive RSI with convergence warmup; applies to price, OI, or L/S ratio. | | `atr` | oscillator | `length` | Average True Range | Wilder's true-range volatility estimator. | | `stoch_k` | oscillator | `length` | Stochastic %K | Fast stochastic oscillator over `length` bars. | | `stoch_d` | oscillator | `length, smooth` | Stochastic %D | Smoothed SMA of %K. | | `williams_r` | oscillator | `length` | Williams %R | Momentum oscillator in [-100, 0]. | | `cci` | oscillator | `length` | Commodity Channel Index | Mean-deviation channel oscillator. | | `mfi` | oscillator | `length` | Money Flow Index | Volume-weighted RSI using true bar volume. | | `bbands_pct` | flow | `field, length, mult` | Bollinger %B | Normalized band location (0 = lower band, 1 = upper band). | | `cvd` | flow | `window` | Cumulative Volume Delta | True signed `taker_buy_amt - taker_sell_amt` sum (not an OBV close-direction proxy). | | `macd` | flow | `field, fast, slow` | MACD Line | Fast EMA minus slow EMA on any field. | | `macd_signal` | flow | `field, fast, slow, signal` | MACD Signal | Converged EMA of the MACD line. | | `macd_hist` | flow | `field, fast, slow, signal` | MACD Histogram | MACD line minus signal line. | | `up_ratio` | regime | `field, window` | Up-Bar Ratio % | Share of bars closing higher than previous bar inside `window`. | | `er` | regime | `field, window` | Kaufman Efficiency Ratio | Net move divided by total path length in [0, 1]; separates clean trends from chop. | | `reg_z` | regime | `field, window` | Regression Channel Z | Residual deviation from rolling linear regression trendline in σ. | | `reg_r2` | regime | `field, window` | Regression Fit R² | Linearity of the rolling trend in [0, 1]. | | `reg_slope_pct` | regime | `field, window` | Regression Slope %/bar | Percentage trend slope per bar from rolling OLS regression. | | `vr` | regime | `field, window, step` | Variance Ratio (Lo-MacKinlay) | VR > 1 signals momentum persistence; VR < 1 signals mean reversion. | --- ## Part 5: Native MCP Server Tool Reference (8 Tools) | Tool Name | Auth | Description | | --- | --- | --- | | `list_markets` | public | List live crypto & TradFi markets across all connected CEX & Perp DEX venues (Binance, OKX, Bybit, Bitget, Hyperliquid, Aster, and expanding), optionally filtered by base token. | | `get_microstructure_klines` | public | Fetch OHLCV + Open Interest + Funding Rate + Orderbook Depth + Taker/Spot Flow Z-score bars (`1m`–`1d`). | | `scan_anomaly_radar` | public | Scan all connected CEX & Perp DEX venues for Whale Accumulation, Spot Divergence, Squeeze Fuel, High Distribution, and Price×OI 4-quadrant regimes. | | `get_carry_matrix` | public | Rank cross-venue Spot+Perp cash-and-carry and Perp+Perp funding spread pairs by net 30d APR after orderbook slippage. | | `list_strategies` | bearer (strategies) | List the authenticated user's saved quantitative strategies and status. | | `create_strategy` | bearer (strategies) | Create or update a validated OpenDepth StrategyDefinition document. | | `compile_ai_strategy` | bearer (strategies) | Compile a plain-language trading thesis into a validated StrategyDefinition (Plus / Pro). | | `get_portfolio_overview` | bearer (strategies) | Fetch multi-strategy dry-run/live equity, symbol exposures, open positions, and account-level risk guard state. | --- ## Part 6: Microstructure Research Notes ### Snapshot vs. 1-Second Time-Weighted Orderbook Depth Across CEXs & Perp DEXs (https://opendepth.io/docs/research/time-weighted-orderbook-depth) Why minute-close orderbook snapshots distort liquidity analytics through transient spoofing, and how OpenDepth's 1-second time-weighted depth bands (±20/100/200/500 bps), absorption, refill latency, and book_complete_bps completeness gating produce reliable microstructure signals. - A single snapshot at the bar close treats a 200-millisecond spoofed wall identically to liquidity resting for all 60 seconds. - Time-weighting 1-second samples across each 1-minute bar reduces transient quote noise by up to 60× and aligns resting depth with actual execution capacity. - OpenDepth pairs four symmetric depth bands (±20, ±100, ±200, ±500 bps) with explicit `book_complete_bps` completeness gating so shallow books emit `null` instead of false zero-depth breakouts. - Every metric is publicly inspectable via `GET https://api.opendepth.io/api/kline-depth` and the zero-auth MCP tool `get_microstructure_klines`. ### Eliminating Survivorship Bias in Crypto Perpetual Backtesting with Delisted Contracts (https://opendepth.io/docs/research/survivorship-bias-delisted-perpetuals) Why backtesting crypto mean-reversion, funding-carry, or momentum strategies solely on currently listed perpetuals systematically overstates Sharpe ratios and masks terminal drawdown tails — and how OpenDepth retains delisted contracts across CEXs & Perp DEXs. - Every delisted perpetual contract that plunged -90% into settlement disappears from standard exchange REST market lists, hiding worst-case drawdowns from naive backtests. - Mean-reversion, RSI oversold, and high-yield funding strategies suffer the heaviest survivorship inflation because dying tokens trigger repeated 'cheap' buy signals right before delisting. - OpenDepth preserves historical 1m–1w bars and explicit `delisted`, `lifecycle`, `delistedAt`, and `lastTradeAt` metadata across connected exchanges. - Combined with strict close-computed / next-open fills and 1-minute TP/SL disambiguation, historical backtests reflect real market mortality. ### Slippage-Adjusted Cross-Venue Funding Carry: Beyond Naive Annualized APR (https://opendepth.io/docs/research/slippage-adjusted-carry-matrix) Why naive funding-rate APR leaderboards mislead arbitrageurs across CEXs & Perp DEXs, how to normalize 1h vs. 8h settlement cadences, and how OpenDepth deducts round-trip 1-second orderbook sweep slippage before ranking live carry pairs. - Two exchanges quoting '40% APR' can deliver vastly different realized returns once entry/exit spread, `T1` sweep slippage, and taker fees are deducted. - Comparing Hyperliquid/Aster (1h funding) against Binance/OKX/Bybit/Bitget (8h funding) requires exact interval normalization plus carry horizon alignment. - Holding-period break-even days (`round_trip_cost_bps / daily_funding_spread_bps`) reveals whether a transient spike can actually repay execution drag before mean-reverting. - Live slippage-adjusted rankings are freely queryable via `GET /api/market/carry` and MCP tool `get_carry_matrix`. --- ## Part 7: Full Operational AI Guide (`ai-guide.md`) # OpenDepth — guide for AI agents This page is written for an AI agent (Claude, ChatGPT, Cursor, a script) acting for an OpenDepth user. It covers everything the agent needs: authentication, membership purchase, strategies and backtests, and alerts. 中文版:https://opendepth.io/ai-guide.zh.md ## What OpenDepth offers - **Multi-venue CEX & Perp DEX, one schema.** Leading CEXs and Perp DEXs (Binance, OKX, Bybit, Bitget, Hyperliquid, Aster, and continuously expanding), perpetuals and spot — 6,000+ markets (including delisted contracts to eliminate survivorship bias), every active one with a fresh 1-minute bar each minute. - **More than candles.** Each bar exposes **75 strategy fields** (54 stored columns + 21 derived microstructure fields): OHLC, candle location and wick metrics; taker buy/sell volume, value, trade count and ticket-size imbalance; open interest, top-trader position/account L/S ratios, global retail L/S ratio, smart-vs-dumb divergence and whale size skew; funding rate; mark/index price and rolling basis; rolling perp & paired-spot flow Z-scores, Kyle's lambda impact asymmetry, passive bid-wall absorption and refill time; plus order-book spread, bid/ask depth at ±20/±100/±200/±500 bps, depth imbalance and buy/sell T1 impact cost. - **Built from raw data.** Bars are aggregated from raw trades rather than copied from exchange candles. Order books are sampled every second and time-weighted, with a completeness gate (`book_complete_bps`) so a thin book is never read as a deep one. - **12 timeframes** (1m to 1w), **33 indicators** (SMA, EMA, WMA, VWAP, RSI, MACD, Bollinger %B, ATR, Stochastic, Williams %R, CCI, MFI, CVD, z-score, percentile rank, `up_ratio`, Kaufman `er`, linear regression channel `reg_z`/`reg_r2`/`reg_slope_pct`, OI-surge anchored VWAP `avwap_oi`, variance ratio `vr`, …), nested any/all/none logic. - **Native MCP Server + OpenAPI 3.1.** Connect Claude Desktop, Cursor, Windsurf, or any MCP client directly to `POST https://api.opendepth.io/api/mcp` (8 tools; 4 public market tools need no API key). Full OpenAPI 3.1 schema at `https://api.opendepth.io/openapi.json`. - **Backtests that match live.** The live evaluator and the backtester share one engine. Backtests simulate trades with next-bar-open fills, stop-loss/take-profit on bar high/low (refined with 1-minute bars when both are hit in one bar), fees, slippage (`fixed`, `book_spread`, `book_impact`), leverage, funding settlements, and approximate liquidation. - **Cheap to run.** Free plan included; Plus $19/month, Pro $49/month. Every plan can scan the whole market; plans differ in strategy count and the shortest bar. Telegram and webhook delivery are included. No per-request API fees. ## 1. Authentication The user creates an API key and hands it to you. You never need their password. 1. The user signs in at https://opendepth.io, opens **Profile → API keys**, and creates a key with the scopes you need. The key (`odk_…`) is shown once. 2. Store it as a secret (for example `OPENDEPTH_API_KEY`) and send it on every call: ``` Authorization: Bearer odk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Content-Type: application/json ``` | Scope | Grants | |---|---| | `strategies` | `/api/account/strategies/*` (strategies, backtests) and `/api/account/plan` (plan, limits, usage) | | `alerts` | `/api/alerts/*` (channels, Telegram binding, signal routing, price alerts) | | `billing` | `/api/account/balance`, `/api/account/deposit/address`, `/api/account/deposit/check`, `/api/account/plan/purchase`, `/api/account/plan/auto-renew`, `/api/account/plan/x402`, `/api/account/balance/x402` | | `read` | `/api/query/*`, `/api/history/*` (exchange accounts the user linked) | | `trade` | `/api/trade/*` (orders on exchange accounts the user linked) | A key can never create or revoke keys, change the password, 2FA or email, or link exchange credentials — those need the user's own session. A call outside a key's scopes returns `403` with `error.requiredScope`. Keys can expire (up to 365 days) and the user can revoke them at any time. Market data endpoints (`/api/kline`, `/api/tokens`) are public and need no key. ## 2. Conventions - Base URL: `https://api.opendepth.io` - Every call is `POST /api//` with a JSON body (send `{}` when there are no fields). No path or query parameters. - Success responses are the object itself, with no envelope. - Errors: `{"error": {"code": "...", "message": "...", "requestId": "...", ...details}}`. | HTTP | `code` | Meaning | |---|---|---| | 400 | `VALIDATION` | Bad input; `error.issues[]` lists `{path, message}` for every problem | | 401 | `UNAUTHORIZED` | Missing, invalid, expired or revoked key | | 402 | `VALIDATION` | The plan does not allow this (limit reached, or balance too low to buy). On the `/x402` endpoints, 402 is the x402 payment request instead (see Buying) | | 409 | `CONFLICT` | A purchase `requestKey` reused for a different purchase, or the price changed (`error.reason: "price_changed"`, `error.currentPriceCents`) | | 403 | `FORBIDDEN` | The key lacks the scope, or the endpoint needs a browser session | | 404 | `NOT_FOUND` | No such strategy / backtest / alert for this user | | 429 | `VALIDATION` | Backtest quota for the hour reached | Market ids look like `binance:perp:BTC:USDT` — `venue:perp|spot:BASE:QUOTE`, venue one of `binance`, `okx`, `bybit`, `hyperliquid`, `aster`. ## 3. Membership ### Plans | | Free | Plus | Pro | |---|---|---|---| | Price | $0 | $19 / month | $49 / month | | Shortest strategy timeframe | 1h | 15m | 1m | | Strategies | 3 | 15 | 50 | | Real-time paper portfolios | 1 | 5 | 25 | | Semi-auto / live auto strategies | 1 | 5 | 20 | | Monthly AI compiler credit | — | $0.95/mo + BYOK | $2.45/mo + BYOK | | Market scope | whole market | whole market | whole market | | Backtests per hour | 5 | 30 | 120 | | Backtests running at once | 1 | 3 | 8 | | Longest backtest range | 90 days | 365 days | 1,095 days | | Alert channels | 2 | 5 | 10 | | Active price alerts | 5 | 50 | 200 | | Fastest price-alert check | 5 min | 1 min | 1 min | Strategies are not metered per market or per check. A save on a timeframe shorter than the plan allows is refused with a 402; if a plan lapses, strategies below the new floor stay saved but are not evaluated until the plan covers them again. The authoritative numbers are always `POST /api/account/plan`, which returns `{plan, label, expiresAt, limits, usage, plans[]}`. ### Buying (scope `billing`) There are two ways to pay. Both need the user's confirmation of the plan and number of months first. Multi-month terms carry tiered discounts (3–5 months: 10% off, 6–11 months: 15% off, 12 months: 20% off). Buying the plan you already have extends it; upgrading Plus → Pro converts remaining Plus value into bonus Pro time (`upgradeBonusMs`); downgrading Pro → Plus while Pro is active is refused (`409` with `error.reason: "downgrade_while_active"`) — schedule a renewal downgrade via `auto-renew` instead. - Live quote: `POST /api/account/plan/quote {"plan": "plus" | "pro", "months": 1-12}` → `{basePriceCents, discountBps, chargedCents, savingsCents, upgradeBonusMs, expiresAt, canPurchaseNow, blockReason}`. - Account overview: `POST /api/account/balance` → `{accountId, balanceCents, plan, expiresAt, autoRenew, scheduledPlan, prices[], pricingTiers[], maxMonths, x402, …}`. `prices` lists the base monthly price of each plan; `x402.enabled` says whether wallet payment is available and `x402.networks` lists its chains. #### Way 1 — pay directly with x402 (an agent with its own wallet) [x402](https://x402.org) lets an HTTP client pay inside the request: the endpoint answers `402` with what to pay, the client signs a USDC transfer authorization (EIP-3009, a signature — no gas needed in the payer wallet), and sends the same request again with the signature. OpenDepth submits it on chain and answers once it is confirmed. - Plan: `POST /api/account/plan/x402 {"plan": "plus" | "pro", "months": 1-12}` → `200 {orderId, plan, months, expiresAt, chargedCents, balanceCents, replayed, payment}` - Top-up: `POST /api/account/balance/x402 {"amountCents": 100-1000000}` → `200 {creditedCents, balanceCents, replayed, payment}` - Asset: USDC on Base (`eip155:8453`), Arbitrum One (`eip155:42161`), Optimism (`eip155:10`) or Ethereum (`eip155:1`) — whichever `accepts[]` in the 402 lists. - Protocol: x402 v2, scheme `exact`. Headers `PAYMENT-REQUIRED` (402), `PAYMENT-SIGNATURE` (your retry), `PAYMENT-RESPONSE` (200). - Keep the `Authorization: Bearer odk_…` header on both requests: the payment is credited to the account the key belongs to. Minimal example — buy Plus for one month, paying USDC on Base: ```ts import { wrapFetchWithPayment, x402Client } from "@x402/fetch"; import { ExactEvmScheme } from "@x402/evm/exact/client"; import { privateKeyToAccount } from "viem/accounts"; const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`); const client = new x402Client().register("eip155:8453", new ExactEvmScheme(account)); const fetchWithPayment = wrapFetchWithPayment(fetch, client); const res = await fetchWithPayment("https://api.opendepth.io/api/account/plan/x402", { method: "POST", headers: { Authorization: `Bearer ${process.env.OPENDEPTH_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ plan: "plus", months: 1 }), }); console.log(res.status, await res.json()); // 200 {plan: "plus", expiresAt, payment: {transaction, explorerUrl}, …} ``` The older `x402-fetch` package exposes the same `wrapFetchWithPayment`; any x402 v2 client works. - `202 {status: "settlement_pending", transaction, explorerUrl}`: the transfer is broadcast but not yet confirmed. Send the **same** request with the **same** `PAYMENT-SIGNATURE` again after a few seconds — one signature is settled at most once, so this cannot pay twice. If you stop, it is still credited within minutes. - `402` after you sent a signature: it was refused; `reason` says why (e.g. `insufficient_funds`, `invalid_exact_evm_payload_signature`, `invalid_network`) and `error` explains it. Nothing was charged. - `501`: wallet payment is not enabled on this server; use Way 2. #### Way 2 — deposit, then buy from the balance (retry-safe) 1. If the balance is short: `POST /api/account/deposit/address` → `{address, chains[]}`. One address works on every listed chain: | Chain | Tokens | |---|---| | Ethereum | USDC, USDT | | Arbitrum One | USDC, USDT | | Base | USDC | | Optimism | USDC, USDT | | BNB Chain | USDC, USDT | Give the address to the user, or send funds yourself if you hold a wallet. It also works for withdrawals from exchanges (Binance, OKX, …) — the network must be one of the above. Deposits are credited after confirmations. **Solana USDC:** when the response has `solana.enabled: true`, `solana.url` is a [Solana Pay](https://docs.solanapay.com/spec) link (`solana:?spl-token=&reference=`). Open it in a Solana wallet, or build the transfer yourself to `solana.recipient` with `solana.reference` included as a read-only account key. A transfer without the reference — every exchange withdrawal — cannot be credited automatically. After sending, call `POST /api/account/deposit/check` → `{creditedCents, balanceCents, watchUntil, errors[]}` to check right away (at most every 15 seconds; `429` otherwise). After `deposit/address` or a check, the account is also checked every minute for 30 minutes, so polling `/api/account/balance` once a minute is enough. 2. `POST /api/account/plan/purchase {"plan": "plus" | "pro", "months": 1-12, "requestKey": "", "expectedPriceCents": 1900}` → `{orderId, plan, months, expiresAt, chargedCents, balanceCents, replayed}`. - `requestKey` (required): a UUID, or 8–100 characters of `A-Z a-z 0-9 _ -`. Generate one per purchase you intend to make. - `expectedPriceCents` (optional): the total you showed the user. If the price changed since, you get `409` with `error.reason: "price_changed"` and `error.currentPriceCents`, and nothing is charged. - `402`: the balance is short (`error.required`, `error.balance`). 3. Optional: `POST /api/account/plan/auto-renew {"enabled": true, "months": 1}` renews from the balance at expiry. Reminders are sent 7 days and 1 day before. **Retrying is safe with the same `requestKey`.** After a timeout, network error or 5xx, send the identical request again with the same key: if the first one went through you get that order back with `replayed: true` and nothing is charged again. Use a new key only for a new purchase. Reusing a key with a different plan or number of months returns `409`. ## 4. Strategies and backtests (scope `strategies`) ### Learn the vocabulary first `POST /api/account/strategies/schema` returns every timeframe, field, indicator (with parameters and bounds), operator, and limit. Build strategies from it rather than from memory. ### Write a strategy `POST /api/account/strategies/create`: ```json { "name": "BTC oversold with whales net long", "signal": "buy", "markets": ["binance:perp:BTC:USDT", "okx:perp:BTC:USDT"], "timeframe": "15m", "cooldownMinutes": 240, "when": { "all": [ { "left": { "indicator": "rsi", "field": "close", "length": 14 }, "op": "<", "right": { "const": 30 } }, { "left": { "field": "top_pos_lsr" }, "op": ">", "right": { "const": 1.5 } }, { "left": { "field": "funding_rate" }, "op": "<", "right": { "const": 0 } } ] } } ``` - Operands: `{"field": …}`, `{"const": n}`, `{"ratio": {"numerator", "denominator"}}`, `{"indicator": …, "field"?: …, …params}`. - Operators: `>`, `>=`, `<`, `<=`, `between` (needs `right2`), `crosses_above`, `crosses_below`, `rises_by` / `falls_by` / `changes_by` (`amount`, `lookback`, `absolute?`), `is_highest` / `is_lowest` (`window`). Any condition may add `forBars` to require it to hold for N bars (not on crosses). - Groups `all`, `any`, `none` nest up to 4 deep; at most 32 conditions. An optional `exitWhen` condition tree (same schema as `when`) can be included to trigger dynamic signal exits at the next bar's open while in a simulated position. - A strategy may need at most 3,000 bars of history per check; very long EMA/RSI/ATR/MACD lengths are rejected with a message saying so. - Scan the whole market instead of a list: send `"markets": []` and `"universe": {"marketTypes": ["perp", "spot"], "exchanges": ["binance", "okx"]}` (`exchanges` optional = all five). Exactly one of a non-empty `markets` (up to 100) or `universe` is required. Every live market in scope is checked each bar, stablecoin pairs excluded; conditions reading open interest, positioning, funding or basis fields run on perps only. Backtests of a universe strategy rank candidate markets (including delisted ones) by historical pre-range volume to avoid lookahead and survivorship bias. - A 400 response lists every problem in `error.issues[]`; fix them all and resend. Other calls: `/list`, `/get {strategyId}`, `/set {strategyId, …full definition}`, `/remove {strategyId}`. Saved strategies with `enabled: true` are evaluated live and send alerts (section 5). ### Run a backtest `POST /api/account/strategies/backtest`: ```json { "strategyId": "…", "from": "2026-01-01T00:00:00Z", "to": "2026-06-30T00:00:00Z", "simulation": { "direction": "long", "stopLossPct": 2, "takeProfitPct": 6, "trailingStopPct": 3, "timeExitBars": 96, "feeBps": 5, "slippageBps": 2, "slippageMode": "book_impact", "positionFraction": 0.5, "leverage": 1, "maxConcurrentPositions": 3, "includeFunding": true } } ``` Returns `{backtestId, status: "queued"}`. Every `simulation` field is optional. Then poll every few seconds: `POST /api/account/strategies/backtest-result {"backtestId": "…"}` → `{backtest}` with `status` `queued` → `running` → `done` | `failed`. Use `/backtests/list {strategyId?, limit?}` and `/backtests/remove {backtestId}` to browse or delete past runs. Without `direction`, a `sell` strategy is simulated short and any other long. A finished result has the signals (the first 5,000; `signalsTruncated` says whether there were more — the simulation always trades all of them), `simulationConfig` with every default filled in, and `simulation` with: - `metrics`: `totalReturnPct`, `maxDrawdownPct`, `trades`, `winRatePct`, `profitFactor`, `avgTradePct`, `sharpe`, `sortino`, `avgMaePct`, `avgMfePct`, `totalFundingPct`, `exposurePct`, `buyHoldReturnPct` - `equity` (up to 500 points), `trades` (up to 2,000, with per-trade `maePct` / `mfePct` / `fundingPct`), `byMarket` attribution, and `assumptions`. How trades are simulated: entry at the next bar's open after a signal; up to `maxConcurrentPositions` (default 1, max 20) simultaneous positions across distinct markets; stop-loss, take-profit, ratcheting `trailingStopPct`, and `exitWhen` dynamic exits; when stop and take-profit are both hit inside one bar, 1-minute bars decide which came first (assuming stop-first when unavailable); `slippageMode` supports `fixed`, `book_spread` (historical half-spread) and `book_impact` (historical T1 depth impact, falling back to fixed bps); `includeFunding: true` incorporates historical perpetual funding settlements. Report `assumptions` to the user with the numbers. The backtest range is limited by the plan (see the table) and by the data available for the market. ## 5. Alerts (scope `alerts`) ### Channels and notification inbox - `POST /api/alerts/channels/list` → `{channels: [{id, kind, target, enabled, deliverable, config?, …}]}`. Only `deliverable` channels receive messages. - **Telegram:** `POST /api/alerts/telegram/link` → `{deepLink, expiresAt}`. Give the link to the user; they open it and press **Start**. It expires in 10 minutes. Poll `channels/list` until a `telegram` channel appears. - **Webhook:** `POST /api/alerts/channels/create {"kind": "webhook", "target": "https://…", "config": {"format": "json" | "feishu" | "dingtalk" | "discord" | "slack"}}`. Returns a one-time HMAC-SHA256 `signingSecret` (`X-OpenDepth-Timestamp` + `X-OpenDepth-Signature: v1=`) and sends a test ping. Update template or per-category/strategy routing with `/api/alerts/webhooks/set {id, format?, routeFilter?}`, or rotate the secret with `/api/alerts/webhooks/rotate-secret {id}`. - **In-app inbox:** `POST /api/alerts/inbox/list {unreadOnly?, limit?}`, `/inbox/mark-read {ids[]}`, `/inbox/mark-all-read {}` (retains 30 days of notifications). - `/enable {id, enabled}`, `/remove {id}`. ### Where strategy signals go `POST /api/alerts/strategy-routing/set {"channels": ["telegram"], "quietHours": {"startHourUtc": 22, "endHourUtc": 6}}` (`quietHours` optional). `/get` returns the current setting. Signals from all strategies for one user are bundled into one message per check. ### Price alerts Checked on the server ~10 seconds after each minute closes against settled 1-minute bars, so a wick between checks is not missed. Supports `price_level`, short-window `pct_move`, and perpetual `funding_rate` alerts plus optional `expiresAt` TTLs. `POST /api/alerts/price/create`: ```json { "marketId": "binance:perp:BTC:USDT", "alertKind": "price_level", "price": "80000", "referencePrice": "77800", "triggerMode": "touch", "repeat": false, "cooldownMinutes": 0, "checkIntervalMinutes": 1, "expiresAt": "2026-12-01T00:00:00Z", "channels": ["telegram"], "note": "breakout" } ``` - `alertKind` (defaults to `"price_level"`): - `"price_level"`: `referencePrice` fixes the direction (`above` or `below`) and must differ from `price`. - `"pct_move"`: pass `direction` (`"above"` for rise ≥ `price`%, `"below"` for drop ≥ `price`%) and `windowMinutes` (`5`, `15`, or `60`); no `referencePrice` needed. - `"oi_move"`: perpetual markets only; pass `direction` (`"above"` for OI surge ≥ `price`%, `"below"` for OI flush ≥ `price`%) and `windowMinutes` (`5`, `15`, or `60`, default `15`); no `referencePrice` needed. - `"funding_rate"`: perpetual markets only; pass `direction` and percentage rate threshold `price` (e.g. `"0.05"` for `0.05%`, signed values allowed); no `referencePrice` needed. - `"basis_bps"`: perpetual markets only; pass `direction` and perp mark−index spread threshold `price` in basis points (signed values allowed); no `referencePrice` needed. - `triggerMode`: `touch` (the bar's high or low reaches the price) or `close` (a bar closes beyond it). - `repeat: true` re-arms after crossing back; `cooldownMinutes` spaces repeats; `expiresAt` (optional ISO timestamp) stops evaluation once expired. - `checkIntervalMinutes`: 1, 5, 15, 30 or 60 (1m minimum on Plus/Pro, 5m on Free). - `channels` omitted means "same as strategy signals". Also: `/list` → `{alerts, plan, limits, activeCount}`, `/set {alertId, …fields, status?: "active" | "paused"}`, `/remove {alertId}`. Get the current price for `referencePrice` from the public kline endpoint below. ## 6. Market data, Whale Radar, Carry Matrix & Macro (public, edge-cached GET, no key) Prefer `GET` with `format=compact` on public endpoints so your calls hit Cloudflare Smart Tiered Cache (`15–60ms` edge responses; `POST` remains supported for backward compatibility): - **Markets & delisted lifecycle:** `GET /api/tokens?token=BTC` (case-insensitive, or `GET /api/tokens` for the full multi-venue CEX & Perp DEX catalog) → asset descriptors, venues, quotes, `lifecycle`, and `delisted` status. - **Microstructure klines (preferred compact GET):** `GET /api/kline?exchange=binance&marketId=binance:perp:BTC:USDT&interval=15m&limit=300&format=compact` → columnar `{cols, rows}` up to 500 bars with `ts` (epoch seconds), `o h l c`, volume (`ba`, `qa`), taker flow, open interest (`oi_b`, `oi_q`), positioning (`tpl`, `tal`, `gl`, `tls`), funding (`fr`), and mark/index price (`mp`, `ip`), plus optional `delisted`, `lifecycle`, `delistedAt`, `lastTradeAt`. Add `&withFeatures=1` for rolling flow Z-scores, Kyle's lambda, absorption, refill time, and basis. Omit `startTime`/`endTime` for edge-cached open-ended latest bars. - **Time-weighted orderbook depth:** `GET /api/kline-depth?exchange=binance&marketId=binance:perp:BTC:USDT&interval=15m&limit=300&format=compact` → 1s time-weighted ±20/±100/±200/±500 bps bid/ask depth, spread bps, depth imbalance, T1 impact bps, and `book_complete_bps`. - **Whale Anomaly Radar:** `GET /api/market/radar?preset=all&quadrant=all&limit=60` (`preset`: `all | whale_accumulation | spot_divergence | squeeze_fuel | high_distribution`; `quadrant`: `all | long_build | short_build | short_cover | long_unwind`; optional `exchange`). - **Cross-Venue Carry Matrix:** `GET /api/market/carry?strategyType=all&limit=60` (`strategyType`: `all | spot_perp | perp_perp`, optional `exchange`, `minNetApr`, `minDepth`) → net 30d APR pairs after round-trip orderbook spread & impact deduction. Authenticated `POST /api/trade/carry/execute` (scope `trade`) executes atomic dual-leg hedges with automatic Leg-1 unwind on Leg-2 failure. - **Macro Economic Calendar:** `GET /api/macro/calendar` → CPI, FOMC, NFP, and other scheduled macro events. - **OpenAPI 3.1 specification:** `GET https://api.opendepth.io/openapi.json`. ## 6b. Model Context Protocol (MCP) Server OpenDepth serves a native Streamable-HTTP JSON-RPC 2.0 MCP endpoint at `POST https://api.opendepth.io/api/mcp` (discovery metadata at `GET https://api.opendepth.io/api/mcp` and `https://opendepth.io/.well-known/mcp.json`). | Tool | Auth required | Purpose | |---|---|---| | `list_markets` | Public (none) | List live markets across all connected CEX & Perp DEX venues, optionally filtered by `token` | | `get_microstructure_klines` | Public (none) | Fetch OHLCV + OI + funding + orderbook depth + flow Z-scores (`1m`–`1d`) | | `scan_anomaly_radar` | Public (none) | Scan Whale Accumulation, Spot Divergence, Squeeze Fuel, Price×OI quadrants | | `get_carry_matrix` | Public (none) | Rank cross-venue Spot+Perp & Perp+Perp carry pairs by net 30d APR | | `list_strategies` | `odk_` (`strategies`) | List saved quantitative strategies | | `create_strategy` | `odk_` (`strategies`) | Create or update a validated strategy definition | | `compile_ai_strategy` | `odk_` (`strategies`, Plus/Pro) | Compile natural-language rules into a validated strategy JSON | | `get_portfolio_overview` | `odk_` (`strategies`) | Fetch multi-strategy dry-run/live portfolio equity, exposures, open positions, risk guard | Example `tools/list` JSON-RPC call: ```bash curl -sS https://api.opendepth.io/api/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' ``` Example MCP client config (Claude Desktop / Cursor / Windsurf): ```json { "mcpServers": { "opendepth": { "url": "https://api.opendepth.io/api/mcp", "headers": { "Authorization": "Bearer odk_your_api_key_optional_for_public_tools" } } } } ``` ## 7. A complete session 1. `POST /api/account/plan` — what plan, what is left this month. 2. If the user wants more: confirm plan and months → either pay with x402 (`/api/account/plan/x402`), or `/api/account/balance` → `/api/account/deposit/address` → deposit → `/api/account/deposit/check`, then `/api/account/balance` until funded → `/api/account/plan/purchase` with a `requestKey`. 3. `POST /api/account/strategies/schema` → `/create` → `/backtest` → poll `/backtest-result` → report metrics and assumptions → adjust with `/set` and repeat. 4. `/api/alerts/channels/list`; if no Telegram, `/api/alerts/telegram/link` and wait for the user. 5. `/api/alerts/strategy-routing/set` so signals reach that channel; keep the strategy `enabled`. 6. `/api/alerts/price/create` for any price levels the user wants watched. ## Official Links - Website: https://opendepth.io - Docs: https://opendepth.io/docs · Methodology: https://opendepth.io/docs/methodology · Indicators: https://opendepth.io/docs/indicators · MCP: https://opendepth.io/docs/mcp - X (Twitter): https://x.com/opendepth_io · Telegram Bot: https://t.me/opendepth_io_bot · GitHub: https://github.com/opendepth-io - Contact: operation@opendepth.io