Claude Code
Claude Code is Anthropic's CLI for developers. With MCP support built in, you can query live market data, pull historical candles, and generate charts directly from your terminal.
Setup¶
-
Set your API key as an environment variable:
Tip
Add the
exportline to your shell profile (~/.zshrcor~/.bashrc) so the key is always available. -
Add the MCP server to your project's
.mcp.jsonor global config at~/.claude.json:
Verify¶
Ask Claude Code:
"What trading assets are available?"
If the connection is working, it will call the e8_trade_asset_list tool and return a list of tradeable instruments.
Example prompts¶
Market data:
- "Get the last 100 hourly candles for BTCUSD and calculate the average volume"
- "Show me the order book for EURUSD with 20 levels of depth"
- "What forex pairs are available for trading? List them as a markdown table."
Trading:
- "What's my account balance and equity?"
- "Buy 0.1 lots of EURUSD at market"
- "Show me my open positions"
- "Close my BTCUSD position"
- "Place a limit buy order for 0.5 lots of XAUUSD at 2300"
- "Cancel order abc123"
- "Close all my open positions"
How to trade¶
Once connected, you can trade entirely through natural language. Here's a typical flow:
- Check your account — "Show me my account info"
- Research — "What's the current price and orderbook for EURUSD?"
- Place an order — "Buy 0.1 lots of EURUSD at market"
- Monitor — "Show me my open positions"
- Close — "Close my EURUSD position"
Your AI assistant translates your requests into the appropriate tool calls. All orders go through the same execution engine as the web terminal — same prices, same slippage checks, same risk controls.
Note
All accounts are demo/evaluation accounts. Trading via MCP uses the same order flow as the web UI — no real money is at risk.