Precise types
Typed endpoint inputs and responses, not dict or Any. Your editor completes the keys.
Async, typed, validated Python clients for every crypto venue we trade on. One namespace. Every exchange.
Typed endpoint inputs and responses, not dict or Any. Your editor completes the keys.
Responses validated by pydantic by default, not just typed on paper.
HTTP, WebSocket, gRPC: whatever each venue actually speaks, all awaitable.
Every documented endpoint, not just the popular ones. Info, exchange, and streams.
One prompt with the typed-binance install command, its env
vars, and a working first call. Paste it into Claude Code, Cursor, or Codex.
.envCreate a .env with your API credentials — see API keys setup for how to create them.
# .env
BINANCE_API_KEY="your_api_key"
BINANCE_SECRET_KEY="your_api_secret"Install the client and python-dotenv to load the .env file.
pip install typed-binance python-dotenvLoad the environment, then make your first call.
from dotenv import load_dotenv
load_dotenv()
from typed_binance import Binance
async with Binance.new() as client:
account = await client.spot.http.account.info()
print(account['balances'])Order books, candles, recent trades, and the tradeable symbol list — all public.
book = await client.spot.http.market.order_book(symbol='BTCUSDT', limit=20) # order book
candles = await client.spot.http.market.klines(symbol='BTCUSDT', interval='1h', limit=10) # candles
trades = await client.spot.http.market.recent_trades(symbol='BTCUSDT', limit=20) # recent trades
info = await client.spot.http.market.exchange_info(symbol='BTCUSDT') # tradeable symbolsA public market-data channel, and your own account's order/balance events.
async with client.spot.streams.ticker('BTCUSDT') as stream: # public ticker updates
async for update in stream:
print(update)
async with client.spot.ws.user_data.events() as events: # this account's order/balance events
async for event in events:
print(event)Submit, query, cancel, and list spot orders. Needs credentials.
order = await client.spot.http.trading.order({
'symbol': 'BTCUSDT', 'side': 'BUY', 'type': 'LIMIT',
'timeInForce': 'GTC', 'quantity': '0.0001', 'price': '20000',
}) # place a limit order
status = await client.spot.http.account.order(symbol='BTCUSDT', order_id=order['orderId']) # check its status
open_orders = await client.spot.http.account.open_orders(symbol='BTCUSDT') # list open orders
await client.spot.http.trading.cancel_order(symbol='BTCUSDT', order_id=order['orderId']) # cancel itBalances, futures positions, and trade history. Needs credentials.
account = await client.spot.http.account.info() # spot balances
trades = await client.spot.http.account.my_trades(symbol='BTCUSDT', limit=50) # trade history
positions = await client.usdm_futures.http.trading.position_risk_v3(symbol='BTCUSDT') # futures positionsList Simple Earn products, subscribe, check your positions, and redeem.
from decimal import Decimal
products = await client.spot.http.simple_earn.flexible.list(asset='USDT') # available products
subscription = await client.spot.http.simple_earn.flexible.subscribe(
product_id='USDT001', amount=Decimal('10'),
) # subscribe
positions = await client.spot.http.simple_earn.flexible.position(asset='USDT') # your positions
await client.spot.http.simple_earn.flexible.redeem(product_id='USDT001', redeem_all=True) # redeemDeposit addresses/history, and submitting or listing withdrawals.
deposit = await client.spot.http.wallet.capital.deposit.address(coin='USDT', network='TRX') # deposit address
deposits = await client.spot.http.wallet.capital.deposit.history(coin='USDT') # deposit history
withdrawal = await client.spot.http.wallet.capital.withdraw.apply(
coin='USDT', network='TRX', address='...', amount=10,
) # submit a withdrawal
withdrawals = await client.spot.http.wallet.capital.withdraw.history(coin='USDT') # withdrawal history