Metadata-Version: 2.4
Name: tachyon-client
Version: 0.1.0
Summary: Read the Tachyon market-fragility state and verify its webhooks.
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: stream
Requires-Dist: websockets>=12; extra == "stream"

# tachyon-client

Reads Tachyon's market-fragility state. Tachyon measures fragility, not price direction, and your
code decides what to do with it.

```python
from tachyon_client import TachyonClient, TachyonError

client = TachyonClient("your-api-key")
try:
    reading = client.state("BTCUSDT")
except TachyonError:
    reading = None

if reading is None or not reading.known:
    ...  # Unknown is not NORMAL.
elif reading.state != "NORMAL":
    ...  # Your policy.
```

Verify a webhook over the raw body, before parsing it:

```python
from tachyon_client import verify_webhook, WebhookError

try:
    event = verify_webhook(raw_body, headers["x-tachyon-signature"], secret)
except WebhookError:
    ...  # Reject it.
```

An event's `event` is `state`, `stale` or `test`. Delivery is at least once and may arrive out of
order: dedupe by `id` and order by `timestamp_ns`. Silence is not `NORMAL`: if you depend on webhooks,
also read `state()` on a timer.

`client.stream(pair)` needs `pip install tachyon-client[stream]`.

## Your own fills by state

See what your Bybit fills paid in each state. It runs on your machine, and Tachyon never receives your
exchange key. Use a read-only key.

```bash
BYBIT_API_KEY=... BYBIT_API_SECRET=... python -m tachyon_client.report --pair BTCUSDT --days 7
```

States come from the public track record, so it covers fills since go-live, and the newest hour is unknown.
It shows what your fills paid, not what you would have saved.
