Skip to content

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

  1. Set your API key as an environment variable:

    export E8_API_KEY="your_api_key_here"
    

    Tip

    Add the export line to your shell profile (~/.zshrc or ~/.bashrc) so the key is always available.

  2. Add the MCP server to your project's .mcp.json or global config at ~/.claude.json:

    {
      "mcpServers": {
        "e8markets": {
          "url": "https://trade.e8markets.com/api/mcp",
          "headers": {
            "Authorization": "Bearer ${E8_API_KEY}"
          }
        }
      }
    }
    

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:

  1. Check your account"Show me my account info"
  2. Research"What's the current price and orderbook for EURUSD?"
  3. Place an order"Buy 0.1 lots of EURUSD at market"
  4. Monitor"Show me my open positions"
  5. 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.