# dYdX MCP for AI Agents AI Agent Connect

> dYdX (Decentralized Perpetual Exchange API) lets you manage your perpetual trading account directly through your AI agent. It gives your agent the ability to fetch real-time orderbooks, track your open positions, and execute limit or market orders on the dYdX Chain. Whether you're looking for deep liquidity data or want to automate order management, this Connector handles the heavy lifting of interacting with the dYdX v4 infrastructure.

## Overview
- **Category:** finance-accounting
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_epUdcvnbX2GX09BMiiE2uKxPkLiXB8RbCsjjEMYJ/ai-agent-connect
- **Tags:** crypto-trading, perpetuals, dex, orderbook, defi

## Description

dYdX (Decentralized Perpetual Exchange API) gives you a direct way to manage your perpetual trading account through an AI agent. Instead of jumping between browser tabs to check prices, monitor your equity, and manually enter orders, you can do it all from your primary workspace. This Connector bridges the gap to the dYdX v4 infrastructure, allowing your agent to pull real-time orderbooks, fetch historical candlestick data, and execute limit or market orders on demand. You can have your agent monitor your open positions and account balances while you focus on your research, or tell it to pull the latest 24h statistics for a specific pair. It turns your AI into a functional trading terminal for the dYdX Chain. Because Vinkius hosts this Connector, you can get connected in minutes and start interacting with the exchange immediately. It takes the friction out of high-frequency monitoring and manual order placement, making it much easier to stay on top of volatile markets while keeping your eyes on the big picture.

## Tools

### v4_get_stats
Fetch 24h rolling statistics for a dYdX v4 market.

### v4_get_trades
Retrieve recent public trade data for a dYdX v4 market.

### v4_list_markets
List all available perpetual markets on dYdX v4.

### v4_list_orders
View all active and historical orders for your dYdX v4 account.

### v4_list_positions
Show all currently open positions on the dYdX v4 exchange.

### v3_create_order
Place a new order on the dYdX v3 platform.

### v3_get_accounts
Retrieve account information for dYdX v3.

### v3_get_orderbook
Fetch the current L2 orderbook for a dYdX v3 market.

### v3_list_markets
View all available markets on dYdX v3.

### v4_cancel_order
Cancel an existing open order on dYdX v4 using its unique ID.

### v4_create_order
Place a new limit or market order on the dYdX v4 exchange.

### v4_get_account
Retrieve balances, positions, and equity for a dYdX v4 account.

### v4_get_candles
Get historical OHLCV candlestick data for any dYdX v4 market.

### v4_get_market
Pull specific details for a dYdX v4 market like BTC-USD.

### v4_get_orderbook
Get the current L2 orderbook for a dYdX v4 market.

### v4_list_fills
List the most recent trade fills for your dYdX v4 account.

## Prompt Examples

**Prompt:** 
```
What's my current balance and what positions do I have open?
```

**Response:** 
```
Checking your dYdX v4 account...

**Account Summary:**
- **Total Equity:** $12,450.00
- **Buying Power:** $15,000.00
- **Margin Balance:** $2,000.00

**Open Positions:**
| Pair | Side | Size | Entry Price |
| :--- | :--- | :--- | :--- |
| BTC-USD | Long | 0.5 BTC | $64,200.00 |

Would you like to see your recent trade fills?
```

**Prompt:** 
```
Show me the orderbook for ETH-USD.
```

**Response:** 
```
Fetching the L2 orderbook for ETH-USD on dYdX v4...

**Current Orderbook:**
- **Best Bid:** $2,540.10
- **Best Ask:** $2,540.85
- **Liquidity:** Significant depth observed within the $2.50 range.

Do you want me to place a limit order based on these prices?
```

**Prompt:** 
```
List all the perpetual markets available on dYdX v4.
```

**Response:** 
```
Here are the current perpetual markets on dYdX v4:

- **BTC-USD**
- **ETH-USD**
- **SOL-USD**
- **LINK-USD**
- **AVAX-USD**

(Total of 45 markets available). Which one would you like more details on?
```

## Capabilities

### Fetch real-time L2 orderbooks
See exactly where the liquidity sits for any perpetual pair on the dYdX Chain.

### Place limit and market orders
Tell your agent to execute trades instantly using natural language commands.

### Monitor open positions and equity
Track your active trades and total account balance without leaving your current app.

### Retrieve historical candlestick data
Pull OHLCV data for any market to perform technical analysis through your agent.

### Track recent trade fills
Get a clear history of your recent executions and public trades for any pair.

### List available perpetual markets
View all active trading pairs and markets supported by the dYdX v4 infrastructure.

## Use Cases

### High-Volatility Order Management
A trader needs to cancel a large order during a flash crash. They ask the agent to use v4_cancel_order immediately.

### Liquidity Analysis
A researcher wants to see how deep the book is for ETH-USD. They ask the agent to pull the L2 orderbook via v4_get_orderbook.

### Portfolio Health Check
A user wants to know their total equity and open positions. They ask the agent to check their account using v4_get_account.

### Strategy Backtesting
A dev wants to see the last 24 hours of trades for a specific pair. They ask the agent to fetch the data using v4_get_trades.

## Benefits

- Monitor your equity and open positions in real-time using v4_get_account to stay on top of your portfolio without manual refreshes.
- Execute trades instantly by telling your agent to use v4_create_order for limit or market orders on the dYdX Chain.
- Analyze market depth by pulling L2 orderbooks with v4_get_orderbook to see where the real liquidity sits.
- Perform technical analysis on any pair by fetching historical data with v4_get_candles for more accurate price predictions.
- Manage your order lifecycle easily by using v4_cancel_order to stop trades or v4_list_orders to see your full history.
- Stay updated on market trends by pulling 24h statistics with v4_get_stats and recent trades via v4_get_trades.

## How It Works

The bottom line is that you get a direct, natural language interface to the dYdX v4 trading engine.

1. Subscribe to the dYdX MCP on Vinkius and provide your API Key, Secret, and Passphrase.
2. Connect your preferred AI client to the Vinkius catalog to authorize the connection.
3. Ask your agent to perform actions like 'show my balance' or 'place a BTC-USD limit order'.

## Frequently Asked Questions

**Can I use the dYdX MCP to trade on my existing account?**
Yes, you can connect your existing dYdX account by providing your API keys. This lets your AI agent execute trades and check balances on your actual account.

**Does the dYdX MCP support the dYdX Chain (v4)?**
Yes, this Connector specifically provides access to the dYdX v4 infrastructure, which is the current standard for the exchange.

**Can my AI agent place limit orders using the dYdX MCP?**
Absolutely. You can give your agent instructions to place limit or market orders on specific pairs using the v4_create_order tool.

**How do I see my open positions with the dYdX MCP?**
Just ask your agent to show your positions. It will use the v4_list_positions tool to give you a clear summary of everything you're currently holding.

**Is it safe to put my dYdX API keys into the Connector?**
Vinkius manages the connection securely. Your keys are used to authenticate the Connector with dYdX, allowing your agent to perform the actions you authorize.

**Can I use the dYdX MCP for technical analysis?**
Yes, you can ask your agent to pull historical candlestick data using v4_get_candles to help you analyze price trends.

**Can I check my current open positions and account balance?**
Yes. You can use `v4_list_positions` to see all active trades and `v4_get_account` with your address to retrieve balances and equity.

**How do I get the latest market price and orderbook depth?**
Use the `v4_get_market` tool for general info or `v4_get_orderbook` for the current L2 state of any specific market like BTC-USD.

**Is it possible to place or cancel trades through the AI?**
Yes. The `v4_create_order` tool allows you to place limit or market orders, and `v4_cancel_order` lets you cancel them using their Order ID.