Metadata-Version: 2.4
Name: cryptoprice-blockxai
Version: 0.1.1
Summary: Super-simple crypto price SDK with caching and retries (Alpha Vantage wrapper)
Author-email: Your Name <you@example.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/yourname/cryptoprice
Project-URL: Issues, https://github.com/yourname/cryptoprice/issues
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.27.0
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: respx>=0.21; extra == "dev"
Dynamic: license-file

# cryptoprice

A tiny Python SDK to get crypto prices in one line – with retries and a TTL cache. Wraps Alpha Vantage’s free API.

```python
from cryptoprice import CryptoPrice

cp = CryptoPrice(api_key="YOUR_ALPHA_VANTAGE_KEY")  # or set env ALPHAVANTAGE_API_KEY
print(cp.get_price("BTC"))     # -> 61234.56 (USD by default)
```

## Install

```
pip install cryptoprice-blockxai
```

## Configure API key

Get a free API key from Alpha Vantage and either:

- Pass directly: `CryptoPrice(api_key="...")`
- Or set environment variable: `export ALPHAVANTAGE_API_KEY=...`

Docs: https://www.alphavantage.co/documentation/

## Why this exists

- Built-in retry-on-failure (including 429/503)
- Fast repeated calls via TTL cache (default 15s)
- Simple, production-ready interface

## API

- `CryptoPrice(vs_currency="usd", ttl_seconds=15.0, api_key=None)`: sync client
  - `get_price("BTC") -> float`
- `CryptoPriceAsync(...).get_price("ETH") -> float`: async variant

## Notes

- Default `vs_currency` is USD. Override with `vs_currency="EUR"`, etc.
- Alpha Vantage endpoint used: `CURRENCY_EXCHANGE_RATE`.
- Respect free API rate limits. Keep a reasonable TTL in production.

## Development

```
python -m venv .venv && . .venv/bin/activate
pip install -e .
pip install pytest respx
pytest
```

## License

MIT
