# Typed Aster

> A fully typed, validated async client for the Aster API.

```python
from typed_aster import Aster

async with Aster.new(public=True) as client:
  book = await client.futures.market.depth('BTCUSDT', limit=5)
  print(book['bids'][0])
```

One `Aster` client covers four surfaces:

- `client.futures`: perpetual futures
- `client.spot`: spot trading
- `client.prediction`: prediction markets
- `client.chain`: Aster Chain (staking, transfers, withdrawals, and on-chain reads by address)

Public market data needs no credentials. Everything signed uses Aster's Pro API wallets. See
[Authenticated Setup](/typed/aster/authenticated-setup).

## Why Typed Aster?

- **🎯 Precise Types**: Typed order unions and `datetime` timestamps across futures, spot, prediction and Aster Chain, not `dict`/`Any`. Prices and quantities Aster sends as strings are `Decimal`; the few amounts it sends as JSON numbers (Aster Chain balances such as `walletBalance`, withdrawal fee estimates, fee caps) are `float`.
- **✅ Runtime Validation**: Every REST, JSON-RPC and WebSocket response is validated by default, not just typed on paper.
- **⚡ Async First**: Async HTTP plus WebSocket market and user-data streams, built for concurrent workflows.
- **📚 Full Surface**: Every documented Pro API endpoint, including strategy orders, sub-accounts, builders, prediction outcomes and staking.

## Installation

```bash
pip install typed-aster
```

## How To

- [Fetch Market Data](/typed/aster/how-to/fetch-market-data)
- [Fetch Account Data](/typed/aster/how-to/fetch-account-data)
- [Place & Manage Orders](/typed/aster/how-to/place-and-manage-orders)
- [Paginate Through Results](/typed/aster/how-to/paginate-through-results)
- [Listen To Live Streams](/typed/aster/how-to/listen-to-live-streams)
- [Trade Prediction Markets](/typed/aster/how-to/trade-prediction-markets)
- [Stake ASTER](/typed/aster/how-to/stake-aster)
- [Manage Deposits & Withdrawals](/typed/aster/how-to/manage-deposits-withdrawals)

## Reference

- [Authenticated Setup](/typed/aster/authenticated-setup)
- [Async Usage](/typed/aster/reference/async-usage)
- [Error Handling](/typed/aster/reference/error-handling)
- [Environment Variables](/typed/aster/reference/env-vars)
- [Timestamps](/typed/aster/reference/timestamps)

## Design Philosophy

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

*Details matter. Developer experience matters.*
