# Dydx Gateway

> Use when the user asks about anything dYdX — markets, prices, funding, OI, volumes, perps — or mentions a perp trader address to vet (equity, PnL curve, day-winrate, maxDD, farmer flag), funding/OI anomalies, liquidation cascades, leaderboards, or wants TA and ATR-based stop plans. Provides dYdX v4 perps analytics via a local read-only MCP gateway: market data, funding heatmap, verified trader PnL, leaderboards, OI and liquidation-cascade anomaly detection.

- Skill: `jiayaoqijia/dydx-gateway` (Agent Skill, multi-file: 5 files)
- Install (CLI): `npx skillmds@latest add jiayaoqijia/dydx-gateway`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jiayaoqijia/dydx-gateway/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- Author: jiayaoqijia (https://skillmd.com/u/jiayaoqijia)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/jiayaoqijia/dydx-gateway

---


# dYdX Agent Gateway (local MCP server)

The gateway is deployed on this host, endpoint **http://127.0.0.1:8901/mcp**
(streamable HTTP, systemd unit `dydx-mcp.service`; check with
`systemctl is-active dydx-mcp`). The code lives at the repository root
of https://github.com/alekskram/dydx-agent-gateway
(the skill's source is `.agents/skills/dydx-gateway/`; after edits,
copy it to `~/.zcode/skills/dydx-gateway/`). If the gateway is not
running, start it per the repo README Install section
(`uvx --from git+https://github.com/alekskram/dydx-agent-gateway
dydx-agent-gateway --http --port 8901`).

Background data: the block scanner (`dydx-scanner`, the address registry
keeps growing), detectors every 5 min (`dydx-detectors.timer`),
leaderboard every 6 h (`dydx-leaderboard.timer`), watchdog report on the
1st of each month.

## MCP tools (22)

Data: `list_markets`, `market_detail`, `candles`, `recent_trades`, `height`
· Analytics: `funding_heatmap(min_oi_usd)`, `historical_funding(limit≤500)`,
`market_ta`, `suggest_stops`, `trader_profile`,
`trader_pnl_stats(limit≤5000)`, `fills_review`, `raw_fills(limit≤200)`,
`cvd(trades_limit)`, `correlation(ticker_a, ticker_b)`
· Discovery: `market_digest` (one-call briefing — start here),
`leaderboard`, `discover_traders`, `list_traders`, `registry_stats`,
`latest_events`, `usage_stats`

## Quick path without an MCP client

```bash
cd <repo root> && python -c "
import sys; sys.path.insert(0,'.')
from dydx_mcp import server as s
import json; print(json.dumps(s.market_digest(), indent=1, default=str)[:800])"
```

Full-blown connections (stdio / Claude Desktop, Codex, Cursor configs):
`examples/` in the repo.

## Important data caveats

Read `references/data-gotchas.md` (5 documented indexer-API gotchas:
candle ordering, netTransfers, priceChange24H, subticksPerTick, no
liquidation feed). Rule of thumb: funding without an OI ≥ $100k filter
is noise.

## Where to look next

- Reports: `reports/` (monthly data-quality watchdog, digests)

