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:

ParameterTypeRequiredDescription
tokenstringYesToken symbol (e.g. BTC, ETH, SOL)
sincestringYesStart timestamp (ISO 8601 or Unix seconds)
untilstringYesEnd timestamp (ISO 8601 or Unix seconds)
formatstringNocsv (default), parquet, or json (OHLCV only)
linkbooleanNoReturn 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:

ParameterTypeRequiredDescription
skip_idbooleanNoExclude 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:

timepriceamountbuyid
2024-01-01T00:00:01.234Z42831.50.0412true3281940012
2024-01-01T00:00:01.891Z42830.00.1200false3281940013
2024-01-01T00:00:02.441Z42832.00.0085true3281940014

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:

ParameterTypeRequiredDescription
windowstringNoCandle 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):

timeopenhighlowclosevolumetrade_count
2024-01-01T00:00:00Z42831.542950.042780.042900.01284.3148291
2024-01-01T01:00:00Z42900.043100.042850.043050.01102.8841837
2024-01-01T02:00:00Z43050.043200.042990.043150.0987.4538204

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:

timetokenpercentagedepthvalueexchange
2025-01-01T00:00:30ZBTC-500142.813,394,1600
2025-01-01T00:00:30ZBTC-10028.52,672,8500
2025-01-01T00:00:30ZBTC204.2393,9600

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:

timetokenopen_interestopen_interest_valueexchange
2024-01-01T00:00:00ZBTC72,450.33,104,904,3600
2024-01-01T00:05:00ZBTC72,510.13,107,483,2860
2024-01-01T00:10:00ZBTC72,380.73,101,922,4140

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:

timetokenrate
2024-01-01T00:00:00ZBTC0.0001
2024-01-01T08:00:00ZBTC0.00008
2024-01-01T16:00:00ZBTC0.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:

timetokentop_trader_count_ratiotop_trader_vol_ratiolong_short_count_ratiotaker_long_short_vol_ratio
2024-01-01T00:00:00ZBTC1.2840.8921.5411.023
2024-01-01T00:05:00ZBTC1.2910.8871.5380.998
2024-01-01T00:10:00ZBTC1.2750.9011.5451.041

Quota

Binance endpoints use a day-based quota model:

EndpointDaily costMax range
Raw trades1,000 per day queried7 days
OHLCV candles100 per day queried31 days
Book depth100 per day queried31 days
Open interest10 per day queried31 days
Funding rate10 per day queried31 days
Long/short ratios10 per day queried31 days

Check response headers X-RateLimit-Remaining and X-Request-Cost to monitor usage.