Is Binance API Free? Complete Guide for Crypto Traders
Everything you need to know about Binance API pricing, rate limits, authentication setup, and how it compares to other finance APIs for algorithmic trading.
Everything you need to know about Binance API pricing, rate limits, authentication setup, and how it compares to other finance APIs for algorithmic trading.
Yes, the Binance API is free. There's no subscription fee, no monthly charge, and no cost to generate an API key. What you pay for is trading — the same 0.1% spot fee (or lower with BNB discounts) that applies whether you trade manually or via API. The API itself is just a door into your account, and that door is open to everyone.
That said, 'free' comes with structure. Binance enforces rate limits, differentiates between endpoint types, and has specific rules around WebSocket connections. Understanding how this works keeps your bot running smoothly instead of getting banned at 3am during a volatility spike.
The Binance API is a programmatic interface that lets you interact with your Binance account — and with market data — without touching the web UI. It's the backbone of every trading bot, portfolio tracker, and signal system that connects to Binance.
There are two main interfaces: REST API for request-response operations (placing orders, checking balances, pulling historical candles), and WebSocket API for real-time streaming data (price ticks, order book updates, trade streams). Both are free.
Binance API keys come in two types: read-only (safe for monitoring tools) and trade-enabled (required for bots that place orders). Always use the minimum permissions your use case requires, and whitelist your IP address in key settings.
The Binance WebSocket API is completely free. You can subscribe to price streams, order book depth, kline (candle) data, and trade streams for any symbol without paying anything beyond your normal trading fees.
Connection limits exist: up to 1024 streams per connection, maximum 300 connections per attempt per 5 minutes. For most traders running bots on a handful of pairs, you'll never hit these limits. If you're building infrastructure that monitors hundreds of symbols simultaneously — like VoiceOfChain does for generating real-time trading signals — you need to architect your WebSocket connections carefully to stay within bounds.
import asyncio
import websockets
import json
async def stream_btc_price():
url = "wss://stream.binance.com:9443/ws/btcusdt@ticker"
async with websockets.connect(url) as ws:
print("Connected to Binance WebSocket")
while True:
msg = await ws.recv()
data = json.loads(msg)
print(f"BTC Price: ${float(data['c']):,.2f} | 24h Change: {float(data['P']):.2f}%")
asyncio.run(stream_btc_price())
This stream requires no API key — public market data streams on Binance are unauthenticated. You only need a key for private streams (your own order updates, account balance changes).
Getting your API key takes about two minutes. Log into Binance, go to Account → API Management, create a key, and save both the API Key and Secret Key — the secret is only shown once.
import hmac
import hashlib
import time
import requests
API_KEY = "your_api_key_here"
API_SECRET = "your_secret_key_here"
BASE_URL = "https://api.binance.com"
def get_account_balance():
endpoint = "/api/v3/account"
timestamp = int(time.time() * 1000)
params = {"timestamp": timestamp}
query_string = "&".join([f"{k}={v}" for k, v in params.items()])
# Sign the request
signature = hmac.new(
API_SECRET.encode("utf-8"),
query_string.encode("utf-8"),
hashlib.sha256
).hexdigest()
params["signature"] = signature
headers = {"X-MBX-APIKEY": API_KEY}
response = requests.get(BASE_URL + endpoint, headers=headers, params=params)
if response.status_code == 200:
balances = response.json()["balances"]
# Filter non-zero balances
return [b for b in balances if float(b["free"]) > 0 or float(b["locked"]) > 0]
else:
raise Exception(f"API Error {response.status_code}: {response.json()['msg']}")
try:
holdings = get_account_balance()
for asset in holdings:
print(f"{asset['asset']}: {asset['free']} free, {asset['locked']} locked")
except Exception as e:
print(f"Error: {e}")
Never hardcode API keys in source code. Use environment variables or a secrets manager. If you accidentally expose a key in a public repo, revoke it immediately from Binance API Management — do not wait.
Rate limits are where 'free' gets real. Binance uses a weight system rather than simple request counts. Each endpoint costs a certain number of request weights, and you have a rolling 1-minute budget of 1200 weights. Exceeding it gets your IP temporarily banned — the ban duration escalates with repeated violations.
| Endpoint | Method | Weight |
|---|---|---|
| GET /api/v3/ticker/price | Public | 2 (single) / 4 (all) |
| GET /api/v3/klines | Public | 2 |
| GET /api/v3/depth | Public | 5-50 (by limit) |
| POST /api/v3/order | Signed | 1 |
| GET /api/v3/account | Signed | 20 |
| GET /api/v3/myTrades | Signed | 20 |
import requests
import time
def safe_api_call(url, headers=None, params=None, max_retries=3):
"""API call with rate limit handling and retry logic."""
for attempt in range(max_retries):
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
# Check remaining weight from headers
used_weight = response.headers.get("X-MBX-USED-WEIGHT-1M", "unknown")
print(f"Weight used this minute: {used_weight}/1200")
return response.json()
elif response.status_code == 429:
# Rate limited - back off
retry_after = int(response.headers.get("Retry-After", 60))
print(f"Rate limited. Waiting {retry_after}s before retry {attempt+1}/{max_retries}")
time.sleep(retry_after)
elif response.status_code == 418:
# IP banned - don't retry
raise Exception("IP temporarily banned. Stop making requests and wait.")
else:
raise Exception(f"Error {response.status_code}: {response.json().get('msg', 'Unknown')}")
raise Exception("Max retries exceeded")
# Example usage
price_data = safe_api_call("https://api.binance.com/api/v3/ticker/price?symbol=ETHUSDT")
print(f"ETH: ${float(price_data['price']):,.2f}")
This comes up often because traders moving from stocks to crypto sometimes wonder if is yahoo finance api free or is google finance api free in the same way Binance is. The short answer: they're structurally different products serving different use cases.
Yahoo Finance's unofficial API (via yfinance library) is free but unsupported — it can break without warning, has no SLA, and Yahoo has repeatedly broken scraping tools. The official Yahoo Finance API requires a paid subscription through RapidAPI for production use, making is yahoo finance api free for commercial use a firm 'no' for anything serious.
Google Finance doesn't offer a public trading API at all — it's purely a display product. If you want Google-quality data infrastructure, you'd be looking at Google Cloud's financial data APIs, which are enterprise-priced.
| API | Free Tier | Real-time | Crypto | Use in Bots |
|---|---|---|---|---|
| Binance API | Yes, full access | Yes | Yes | Yes |
| Bybit API | Yes, full access | Yes | Yes | Yes |
| OKX API | Yes, full access | Yes | Yes | Yes |
| Yahoo Finance (yfinance) | Unofficial only | Delayed | Limited | Risky |
| Google Finance | No public API | N/A | No | No |
| CoinGecko API | Yes (limited) | Near real-time | Yes | Read-only |
For crypto trading specifically, Binance, Bybit, and OKX all offer genuinely free, well-documented APIs with real-time WebSocket access. Platforms like Bitget and Gate.io follow the same model. The ecosystem is frankly more developer-friendly than traditional finance, partly because crypto exchanges compete for algo traders' volume.
The Binance API is genuinely free for everything except trading itself — and you'd pay those fees manually anyway. The WebSocket API streams real-time data at no cost, REST endpoints cover every account operation you need, and the authentication system is straightforward once you understand HMAC signing.
For traders looking to act on API data rather than just collect it, platforms like VoiceOfChain aggregate real-time signals across multiple exchanges — processing WebSocket feeds from Binance, Bybit, OKX, and others to surface actionable intelligence without building that infrastructure yourself.
The real investment in Binance API isn't money — it's time. Understanding rate limits, building robust error handling, and structuring your WebSocket connections for reliability takes effort. But the foundation is solid, well-documented, and free. That's a better starting point than most financial data ecosystems outside crypto.