# Quick start

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.

Two ways in: a **REST API** for simple pulls, and **direct SQL** (ClickHouse) for bulk analytics and server-side compute. 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).

## 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).

## 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).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.koinju.io/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
