Binance Exchange Data
Binance endpoints serve trade data (raw ticks and OHLCV candles) and perpetual futures derivatives metrics (book depth, open interest, funding rates, long/short ratios).
All Binance endpoints use time ranges (since/until) instead of block ranges, and return CSV or Parquet (except OHLCV which also supports JSON).
Common Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Yes | Token symbol (e.g. BTC, ETH, SOL) |
since | string | Yes | Start timestamp (ISO 8601 or Unix seconds) |
until | string | Yes | End timestamp (ISO 8601 or Unix seconds) |
format | string | No | csv (default), parquet, or json (OHLCV only) |
link | boolean | No | Return a download URL instead of data directly |
Raw Trades
Endpoint: GET /v1/binance/trades/raw
Tick-level trade records. Each row is one matched trade on the exchange order book.
Time range limit: Maximum 7 days per request.
Additional Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
skip_id | boolean | No | Exclude the id column (default: false) |
Columns: time, price, amount, buy, id
curl -H "X-API-Key: $API_KEY"
"https://api.defistream.dev/v1/binance/trades/raw?token=BTC&since=2024-01-01&until=2024-01-02"
-o btc_trades.parquet Sample Results:
| time | price | amount | buy | id |
|---|---|---|---|---|
| 2024-01-01T00:00:01.234Z | 42831.5 | 0.0412 | true | 3281940012 |
| 2024-01-01T00:00:01.891Z | 42830.0 | 0.1200 | false | 3281940013 |
| 2024-01-01T00:00:02.441Z | 42832.0 | 0.0085 | true | 3281940014 |
OHLCV Candles
Endpoint: GET /v1/binance/trades/ohlcv
OHLCV candles aggregated to the requested window. Supports JSON, CSV, and Parquet.
Time range limit: Maximum 31 days per request.
Additional Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
window | string | No | Candle window: 1m, 5m, 15m, 30m, 1h (default), 4h, 1d |
Columns: time, open, high, low, close, volume, trade_count
# JSON (default)
curl -H "X-API-Key: $API_KEY"
"https://api.defistream.dev/v1/binance/trades/ohlcv?token=BTC&window=1h&since=2024-01-01&until=2024-01-02"
# Daily candles as Parquet
curl -H "X-API-Key: $API_KEY"
"https://api.defistream.dev/v1/binance/trades/ohlcv?token=ETH&window=1d&since=2024-01-01&until=2025-01-01&format=parquet"
-o eth_daily.parquet Sample Results (window=1h):
| time | open | high | low | close | volume | trade_count |
|---|---|---|---|---|---|---|
| 2024-01-01T00:00:00Z | 42831.5 | 42950.0 | 42780.0 | 42900.0 | 1284.31 | 48291 |
| 2024-01-01T01:00:00Z | 42900.0 | 43100.0 | 42850.0 | 43050.0 | 1102.88 | 41837 |
| 2024-01-01T02:00:00Z | 43050.0 | 43200.0 | 42990.0 | 43150.0 | 987.45 | 38204 |
Book Depth
Endpoint: GET /v1/binance/book_depth
BPS-level order book depth snapshots. 12 rows per snapshot at fixed percentage levels from mid-price (±20, ±100, ±200, ±300, ±400, ±500 bps), captured every ~30 seconds.
Time range limit: Maximum 31 days per request.
Columns: time, token, percentage, depth, value, exchange
curl -H "X-API-Key: $API_KEY"
"https://api.defistream.dev/v1/binance/book_depth?token=BTC&since=2025-01-01&until=2025-02-01"
-o btc_book_depth.parquet Sample Results:
| time | token | percentage | depth | value | exchange |
|---|---|---|---|---|---|
| 2025-01-01T00:00:30Z | BTC | -500 | 142.8 | 13,394,160 | 0 |
| 2025-01-01T00:00:30Z | BTC | -100 | 28.5 | 2,672,850 | 0 |
| 2025-01-01T00:00:30Z | BTC | 20 | 4.2 | 393,960 | 0 |
Open Interest
Endpoint: GET /v1/binance/open_interest
5-minute open interest snapshots for perpetual futures contracts.
Time range limit: Maximum 31 days per request.
Columns: time, token, open_interest, open_interest_value, exchange
curl -H "X-API-Key: $API_KEY"
"https://api.defistream.dev/v1/binance/open_interest?token=BTC&since=2024-01-01&until=2025-01-01"
-o btc_oi.parquet Sample Results:
| time | token | open_interest | open_interest_value | exchange |
|---|---|---|---|---|
| 2024-01-01T00:00:00Z | BTC | 72,450.3 | 3,104,904,360 | 0 |
| 2024-01-01T00:05:00Z | BTC | 72,510.1 | 3,107,483,286 | 0 |
| 2024-01-01T00:10:00Z | BTC | 72,380.7 | 3,101,922,414 | 0 |
Funding Rate
Endpoint: GET /v1/binance/funding_rate
Perpetual futures funding rates. Interval varies by symbol (typically 8h).
Time range limit: Maximum 31 days per request.
Columns: time, token, rate
curl -H "X-API-Key: $API_KEY"
"https://api.defistream.dev/v1/binance/funding_rate?token=BTC&since=2024-01-01&until=2025-01-01"
-o btc_fr.csv Sample Results:
| time | token | rate |
|---|---|---|
| 2024-01-01T00:00:00Z | BTC | 0.0001 |
| 2024-01-01T08:00:00Z | BTC | 0.00008 |
| 2024-01-01T16:00:00Z | BTC | 0.00012 |
Long/Short Ratios
Endpoint: GET /v1/binance/long_short_ratios
5-minute long/short sentiment ratios for perpetual futures.
Time range limit: Maximum 31 days per request.
Columns: time, token, top_trader_count_ratio, top_trader_vol_ratio, long_short_count_ratio, taker_long_short_vol_ratio, exchange
- top_trader_count_ratio: top 20% traders long/short account ratio
- top_trader_vol_ratio: top 20% traders long/short position ratio
- long_short_count_ratio: global long/short account ratio
- taker_long_short_vol_ratio: taker buy/sell volume ratio
curl -H "X-API-Key: $API_KEY"
"https://api.defistream.dev/v1/binance/long_short_ratios?token=BTC&since=2024-01-01&until=2025-01-01"
-o btc_lsr.parquet Sample Results:
| time | token | top_trader_count_ratio | top_trader_vol_ratio | long_short_count_ratio | taker_long_short_vol_ratio |
|---|---|---|---|---|---|
| 2024-01-01T00:00:00Z | BTC | 1.284 | 0.892 | 1.541 | 1.023 |
| 2024-01-01T00:05:00Z | BTC | 1.291 | 0.887 | 1.538 | 0.998 |
| 2024-01-01T00:10:00Z | BTC | 1.275 | 0.901 | 1.545 | 1.041 |
Quota
Binance endpoints use a day-based quota model:
| Endpoint | Daily cost | Max range |
|---|---|---|
| Raw trades | 1,000 per day queried | 7 days |
| OHLCV candles | 100 per day queried | 31 days |
| Book depth | 100 per day queried | 31 days |
| Open interest | 10 per day queried | 31 days |
| Funding rate | 10 per day queried | 31 days |
| Long/short ratios | 10 per day queried | 31 days |
Check response headers X-RateLimit-Remaining and X-Request-Cost to monitor usage.