> For the complete documentation index, see [llms.txt](https://docs.koinju.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.koinju.io/readme.md).

# Quick start

Koinju delivers crypto market data from exchanges over SQL and REST in one normalized schema, covering trades, OHLCV candles, funding rates and option Greeks. Query a free demo database with no accoun

Comparing crypto market data providers? Check Koinju's coverage yourself, with no account and no key. The [free demo database](/free-demo-database.md) holds the previous day of every exchange, and each link below returns JSON.

* [Coverage: markets and trades held per exchange](https://sn7u7x3woz.eu-central-1.aws.clickhouse.cloud:8443/?user=demo\&default_format=JSONEachRow\&query=SELECT%20exchange%2C%20uniqExact%28market%29%20AS%20markets%2C%20sum%28count%29%20AS%20trades%20FROM%20public_data.candle_1m%20GROUP%20BY%20exchange%20ORDER%20BY%20trades%20DESC)
* [Granularity: the latest five trades of Coinbase BTC-USD, with side, price and quantity](https://sn7u7x3woz.eu-central-1.aws.clickhouse.cloud:8443/?user=demo\&default_format=JSONEachRow\&query=SELECT%20exchange%2C%20market%2C%20timestamp%2C%20side%2C%20price%2C%20quantity%2C%20trade_id%20FROM%20api.trade%20WHERE%20exchange%20%3D%20%27coinbase%27%20AND%20market%20%3D%20%27BTC-USD%27%20ORDER%20BY%20timestamp%20DESC%20LIMIT%205)
* [Derivatives: the latest funding rate of the BTC-margined perpetual BTC-USD-PERP-INV on each exchange](https://sn7u7x3woz.eu-central-1.aws.clickhouse.cloud:8443/?user=demo\&default_format=JSONEachRow\&query=SELECT%20exchange%2C%20argMax%28funding_rate%2C%20timestamp%29%20AS%20last_rate%2C%20max%28timestamp%29%20AS%20last_settled_at%20FROM%20api.funding_rate%20WHERE%20market%20%3D%20%27BTC-USD-PERP-INV%27%20GROUP%20BY%20exchange%20ORDER%20BY%20last_rate%20DESC)

Koinju delivers institutional-grade crypto market data — tick trades (418 billion+ since 2013), OHLCV candles, funding rates, and recomputed option Greeks — across 13 exchanges under one normalized schema.

Three ways in: a **REST API** for simple pulls, **direct SQL** (ClickHouse) for bulk analytics and server-side compute, and an [**MCP server**](/mcp-server.md) that hands the same data to an AI coding agent as tools. See [Pricing](/pricing.md) for tiers.

Zero to a plotted BTC chart in three steps. Full connector reference (Rust, Go, CLI, BI tools, REST) is in [How to connect](/how-to-connect.md).

{% hint style="success" %}
**Using an AI coding agent?** Install the [Koinju agent skill](/ai-agent-skill.md) so Claude Code / Cursor / Copilot already know the schema, auth, and query patterns and can help you get started with Koinju API faster.

```bash
npx skills add https://gitlab.com/koinju-public/agent-skill
```

Then connect the [MCP server](/mcp-server.md) so it can pull the data itself, in one line:

```bash
claude mcp add --transport http koinju https://mcp.koinju.io/mcp --header "x-api-key: YOUR_API_KEY"
```

{% endhint %}

## 1. Get credentials

You need a database URL (host), username, and password. Sign up at [koinju.io/pricing](https://koinju.io/pricing) to get them, or email [support@koinju.io](mailto:support@koinju.io?subject=SQL%20API%20credentials%20request).

No account yet? [Query the free demo database](/free-demo-database.md).

## 2. First SQL query (Python)

```
pip install clickhouse-connect pandas matplotlib
```

```python
import clickhouse_connect

conn = clickhouse_connect.get_client(
    host="<provided_database_url>",
    port=8443,
    secure=True,
    username="<username>",
    password="<password>",
    database="api",
)

df = conn.query_df(
    """
    SELECT start, exchange, market, toFloat64(close) AS close
    FROM api.ohlcv(candle_duration_in_minutes = 1440)
    WHERE market IN ('BTC-USD', 'BTC-USDT')
      AND start >= now() - INTERVAL 90 DAY
    ORDER BY start
    """
)
print(df.head())
```

`api.ohlcv(candle_duration_in_minutes = 1440)` is a parameterized view (`1440` = daily candles). `close` is a high-precision Decimal — cast it with `toFloat64(close)` before arithmetic.

{% hint style="info" %}
The `market` symbol is quoted per venue: USD venues (Coinbase, Kraken, Bitstamp) publish `BTC-USD`; USDT venues (Binance, OKX, Bybit, KuCoin, Gate.io) publish `BTC-USDT`. These are **different markets** — to see BTC across all exchanges filter `market IN ('BTC-USD', 'BTC-USDT')`.
{% endhint %}

## 3. First plot — average BTC price across all exchanges

```python
import matplotlib.pyplot as plt

avg = df.groupby("start")["close"].mean()

avg.plot()
plt.title("Average BTC price across all exchanges (daily close)")
plt.ylabel("USD")
plt.show()
```

Next: browse [Data](/data/coverage.md), or use the REST option in [How to connect](/how-to-connect.md).
