Hand it to your coding agent

One prompt with the typed-bybit install command, its env vars, and a working first call. Paste it into Claude Code, Cursor, or Codex.

Typed Bybit

A fully typed, validated async client for the Bybit v5 API.

from typed_bybit import Bybit

async with Bybit.new(public=True) as client:
  ticker = await client.market.tickers(category='spot', symbol='BTCUSDT')
  print(ticker['list'][0]['lastPrice'])

Why Typed Bybit?

  • 🎯 Precise Types: Typed inputs and responses across REST and WebSocket, discriminated by product category, for trading, positions, account, assets, and earn products alike.
  • ✅ Runtime Validation: Responses and pushed stream messages validated by default.
  • ⚡ Async First: One shared HTTP pool and nine lazily-opened WebSocket connections, built for concurrent workflows.
  • 📚 Full Surface: Nearly the entire documented v5 REST and WebSocket surface — market data, order entry, positions, account, assets, earn, and more.

Installation

pip install typed-bybit

The Client

Bybit reaches every REST product domain and every WebSocket connection directly as a top-level attribute — there's no .http/.ws split to go through first:

from typed_bybit import Bybit

async with Bybit.new(public=True) as client:
  candles = await client.market.kline(category='spot', symbol='BTCUSDT', interval='60', limit=3)
  book = await client.market.orderbook(category='spot', symbol='BTCUSDT', limit=5)
  trades = await client.market.recent_trades(category='spot', symbol='BTCUSDT', limit=3)
  print(candles['list'][0], book['b'][0], trades['list'][0]['price'])

client.market covers the public REST Market surface. Every other REST domain — trade, position, account, asset, finance and the rest — needs credentials, as do client.private and client.trade_ws. client.spot, .linear, .inverse, and .option are the public-category WebSocket streams with no REST name to share, while client.spread_ws, .rfq_ws, and .finance_ws are their _ws-suffixed counterparts to the REST spread, rfq, and finance domains. See API Keys Setup for credentials and Async Usage for the full transport layout.

How To

Reference

Design Philosophy

Typed Bybit follows the principles outlined in this blog post.

Details matter. Developer experience matters.