Quick Start

Get live market intelligence from 13 exchanges in under 2 minutes.

1. Get Your API Key

  1. Sign up (free, no credit card)
  2. Your API key is auto-generated — copy it from the Dashboard

Your key looks like: mk_live_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345

2. Make Your First Request

curl -H "Authorization: Bearer mk_live_YOUR_KEY" \
  https://api.market-ai.dev/v1/quotes/BTC/USDT

Response:

{
  "ok": true,
  "data": {
    "symbol": "BTC/USDT",
    "global_mid": "67432.50",
    "global_vwap": "67430.12",
    "max_arb_bps": 4.2,
    "consensus_trend": "bullish",
    "exchanges": [
      { "exchange": "binance", "bid": "67430", "ask": "67435", "volume_24h": "1.2B" },
      { "exchange": "bybit", "bid": "67428", "ask": "67436", "volume_24h": "890M" }
    ]
  }
}

3. Integration Snippets

Python

import requests

API_KEY = "mk_live_YOUR_KEY"
BASE = "https://api.market-ai.dev"

headers = {"Authorization": f"Bearer {API_KEY}"}

# Get market context (compact ~300-token summary)
r = requests.get(f"{BASE}/v1/quotes/BTC/USDT", headers=headers)
quote = r.json()["data"]
print(f"BTC mid: ${quote['global_mid']}, trend: {quote['consensus_trend']}")

# Get active signals
signals = requests.get(f"{BASE}/v1/signals?severity=alert", headers=headers).json()["data"]
for s in signals:
    print(f"[{s['severity']}] {s['signal_type']}: {s['narrative']}")

# Get funding rates across exchanges
funding = requests.get(f"{BASE}/v1/funding/BTC/USDT", headers=headers).json()["data"]
for f in funding:
    print(f"{f['exchange']}: {f['rate']}%")

TypeScript

const API_KEY = "mk_live_YOUR_KEY";
const BASE = "https://api.market-ai.dev";

async function getQuote(symbol: string) {
  const res = await fetch(`${BASE}/v1/quotes/${symbol}`, {
    headers: { Authorization: `Bearer ${API_KEY}` },
  });
  const { data } = await res.json();
  return data;
}

async function getSignals(severity?: string) {
  const url = severity ? `${BASE}/v1/signals?severity=${severity}` : `${BASE}/v1/signals`;
  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${API_KEY}` },
  });
  const { data } = await res.json();
  return data;
}

// Usage
const btc = await getQuote("BTC/USDT");
console.log(`BTC: $${btc.global_mid} (${btc.consensus_trend})`);

const alerts = await getSignals("alert");
alerts.forEach((s: any) => console.log(`[${s.severity}] ${s.narrative}`));

Rust

use reqwest::header::{HeaderMap, AUTHORIZATION};
use serde::Deserialize;

#[derive(Deserialize)]
struct ApiResponse<T> {
    ok: bool,
    data: T,
}

#[derive(Deserialize)]
struct Quote {
    symbol: String,
    global_mid: String,
    consensus_trend: String,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api_key = "mk_live_YOUR_KEY";
    let base = "https://api.market-ai.dev";

    let client = reqwest::Client::new();
    let mut headers = HeaderMap::new();
    headers.insert(AUTHORIZATION, format!("Bearer {api_key}").parse()?);

    let resp: ApiResponse<Quote> = client
        .get(format!("{base}/v1/quotes/BTC/USDT"))
        .headers(headers)
        .send()
        .await?
        .json()
        .await?;

    println!("BTC: ${} ({})", resp.data.global_mid, resp.data.consensus_trend);
    Ok(())
}

WebSocket (Real-Time)

const ws = new WebSocket("wss://ws.market-ai.dev?key=mk_live_YOUR_KEY");

ws.onopen = () => {
  ws.send(JSON.stringify({
    action: "subscribe",
    channels: [
      { type: "quotes", symbols: ["BTC/USDT", "ETH/USDT"] },
      { type: "signals" },
    ],
  }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type === "update") {
    console.log(`[${msg.channel}]`, msg.data);
  }
};

4. MCP Setup (Claude Desktop / Cursor)

Add this to your MCP client config:

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "market-ai": {
      "url": "https://mcp.market-ai.dev/sse",
      "headers": {
        "Authorization": "Bearer mk_live_YOUR_KEY"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project:

{
  "mcpServers": {
    "market-ai": {
      "url": "https://mcp.market-ai.dev/sse",
      "headers": {
        "Authorization": "Bearer mk_live_YOUR_KEY"
      }
    }
  }
}

Once connected, your AI assistant can call tools like get_market_context, get_signals, get_orderbook, get_funding_rates, and more.

5. LLM Prompts

Copy-paste these into Claude or ChatGPT to generate full integrations:

Python Trading Bot

Build me a Python trading bot using the Market.ai API (https://api.market-ai.dev).
My API key is mk_live_XXXX. The API uses Bearer token auth.

Key endpoints:
- GET /v1/quotes/:symbol — aggregated quote (global_mid, consensus_trend, exchanges)
- GET /v1/signals — market signals (whale_movement, liquidation_cascade, funding_spike, etc.)
- GET /v1/funding/:symbol — funding rates across exchanges
- GET /v1/book/:exchange/:symbol — analyzed orderbook with walls, OBI, depth
- GET /v1/arb — cross-exchange arbitrage opportunities
- GET /v1/polymarket/:coin/:timeframe — prediction market probabilities

All responses: { "ok": true, "data": {...} }
All prices are strings (not floats) for precision.

Build a bot that:
1. Polls BTC/USDT quotes every 30 seconds
2. Monitors signals for whale_movement and liquidation_cascade
3. Logs funding rate divergences across exchanges
4. Alerts when arbitrage spread > 10 bps

TypeScript Data Pipeline

Build me a TypeScript real-time market data pipeline using the Market.ai WebSocket API.

WebSocket endpoint: wss://ws.market-ai.dev?key=mk_live_XXXX

Protocol:
- Subscribe: {"action":"subscribe","channels":[{"type":"quotes","symbols":["BTC/USDT"]}]}
- Updates arrive as: {"type":"update","channel":"quotes","data":{...}}
- Channels: quotes, signals, trades, book, funding, liquidations, polymarket

Build a pipeline that:
1. Connects via WebSocket with auto-reconnect
2. Subscribes to quotes for BTC/USDT, ETH/USDT, SOL/USDT
3. Subscribes to the signals channel for real-time alerts
4. Logs all data to a local SQLite database
5. Prints a summary every 60 seconds

Rust Real-Time Agent

Build me a Rust async market data agent using the Market.ai REST API (https://api.market-ai.dev).

Use reqwest for HTTP, tokio for async, serde for JSON deserialization.
Auth: Bearer token in Authorization header.

Key endpoints:
- GET /v1/quotes/:symbol — { symbol, global_mid, consensus_trend, exchanges[] }
- GET /v1/signals?severity=alert — [{ signal_type, symbol, severity, narrative }]
- GET /v1/funding/:symbol — [{ exchange, rate, next_funding_time }]
- GET /v1/arb?min_bps=5 — [{ symbol, buy_exchange, sell_exchange, spread_bps }]

All prices are strings. Responses wrapped in { "ok": true, "data": T }.

Build an agent that:
1. Polls quotes for BTC, ETH, SOL every 10 seconds
2. Checks for signals with severity >= "alert"
3. Calculates optimal arb routes
4. Outputs a structured market report to stdout every minute