Typed dYdX
A fully typed, validated async client for the dYdX Indexer, Chain (Cosmos gRPC + CometBFT), and Node APIs.
from typed_dydx import Dydx
async with Dydx.testnet(public=True) as client:
market = await client.indexer.data.get_market('BTC-USD')
candles = await client.indexer.streams.candles('ETH-USD', resolution='1MIN')
async for candle in candles:
print(candle)
break
await candles.unsubscribe()
balances = await client.chain.bank.all_balances('dydx1...', resolve_denom=False)
block = await client.chain.comet.block()
result = await client.node.place_order(market, order={
'side': 'BUY',
'size': '0.0001',
'price': '50000',
'flags': 'LONG_TERM',
})Why Typed dYdX?
- 🎯 Precise Types: Typed inputs and responses across the Indexer, Chain, and Node surfaces.
- ✅ Runtime Validation: Indexer and Comet responses validated by default.
- ⚡ Async First: Indexer HTTP and WebSocket streams, Cosmos gRPC queries, and signed node transactions.
- 📚 Full Surface:
client.indexer,client.chain, andclient.nodecover market data, account history, chain state, and order placement.
Installation
pip install typed-dydxHow To
- Place & Manage Orders
- Fetch Market Data
- Manage Account Data
- Query Chain State
- Inspect Blocks & Transactions
- Listen To Streams
- Paginate Through Results
Reference
Design Philosophy
Typed dYdX follows the principles outlined in this blog post.
Details matter. Developer experience matters.