Metadata-Version: 2.4
Name: typed-dydx
Version: 3.0.0
Summary: A fully typed, validated async client for the dYdX Indexer, Node and CosmosSDK/CometBFT APIs.
Author-email: Marcel Claramunt <marcel@tribulnation.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/tribulnation/typed
Project-URL: Documentation, https://tribulnation.com/typed/dydx
Project-URL: Website, https://tribulnation.com/typed
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typed-core>=0.2.0
Requires-Dist: lazy-loader
Requires-Dist: betterproto2==0.9.*
Requires-Dist: grpclib
Requires-Dist: httpx
Requires-Dist: typing-extensions
Requires-Dist: bech32
Requires-Dist: bip-utils
Requires-Dist: coincurve
Requires-Dist: pycryptodome
Dynamic: license-file

<p align="center">
  <a href="https://tribulnation.com/typed/dydx">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tribulnation/typed/refs/heads/main/packages/dydx/media/dydx-dark.svg">
      <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tribulnation/typed/refs/heads/main/packages/dydx/media/dydx-light.svg">
      <img alt="Typed dYdX" src="https://raw.githubusercontent.com/tribulnation/typed/refs/heads/main/packages/dydx/media/dydx-light.svg" width="360">
    </picture>
  </a>
</p>

<p align="center">
  <em>A fully typed, validated async client for the dYdX Indexer, Chain (Cosmos gRPC + CometBFT), and Node APIs.</em>
</p>

<p align="center">
  <a href="https://pypi.org/project/typed-dydx/">
    <img src="https://img.shields.io/pypi/v/typed-dydx.svg" alt="PyPI version">
  </a>
  <a href="https://pypi.org/project/typed-dydx/">
    <img src="https://img.shields.io/pypi/pyversions/typed-dydx.svg" alt="Python versions">
  </a>
  <a href="https://tribulnation.com/typed/dydx">
    <img src="https://img.shields.io/badge/docs-live-black" alt="Docs">
  </a>
  <a href="LICENSE">
    <img src="https://img.shields.io/pypi/l/typed-dydx.svg" alt="License">
  </a>
</p>

---

- **Documentation**: [https://tribulnation.com/typed/dydx](https://tribulnation.com/typed/dydx)
- **Source Code**: [https://github.com/tribulnation/typed/tree/main/packages/dydx](https://github.com/tribulnation/typed/tree/main/packages/dydx)

---

```python
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`, and `client.node` cover market data, account history, chain state, and order placement.

## Installation

```bash
pip install typed-dydx
```

## How To

- [Place & Manage Orders](https://tribulnation.com/typed/dydx/how-to/place-and-manage-orders)
- [Fetch Market Data](https://tribulnation.com/typed/dydx/how-to/fetch-market-data)
- [Manage Account Data](https://tribulnation.com/typed/dydx/how-to/manage-account-data)
- [Query Chain State](https://tribulnation.com/typed/dydx/how-to/query-chain-state)
- [Inspect Blocks & Transactions](https://tribulnation.com/typed/dydx/how-to/inspect-blocks-and-transactions)
- [Listen To Streams](https://tribulnation.com/typed/dydx/how-to/listen-to-streams)
- [Paginate Through Results](https://tribulnation.com/typed/dydx/how-to/paginate-through-results)

## Reference

- [Wallet Setup](https://tribulnation.com/typed/dydx/authenticated-setup)
- [Async Usage](https://tribulnation.com/typed/dydx/reference/async-usage)
- [Error Handling](https://tribulnation.com/typed/dydx/reference/error-handling)
- [Environment Variables](https://tribulnation.com/typed/dydx/reference/env-vars)
- [Timestamps](https://tribulnation.com/typed/dydx/reference/timestamps)

## Design Philosophy

Typed dYdX follows the principles outlined in [this blog post](https://tribulnation.com/blog/clients).

*Details matter. Developer experience matters.*

## License

MIT — see [LICENSE](LICENSE).
