Metadata-Version: 2.4
Name: rate-api-python
Version: 1.0.0
Summary: Official Python client for the Rate-API.com exchange-rate & crypto API
License: MIT
Project-URL: Homepage, https://rate-api.com
Project-URL: Documentation, https://rate-api.com/en/docs
Project-URL: Repository, https://github.com/Vilgar/rate-api.com
Keywords: exchange-rate,currency,forex,crypto,api,rate-api
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# rate-api-python

Official Python client for [Rate-API.com](https://rate-api.com). Standard library only — no dependencies. Python 3.8+.

## Install

```bash
pip install rate-api-python
```

## Usage

```python
from rate_api import RateApiClient, RateApiError

client = RateApiClient("YOUR_API_KEY")

rates = client.latest("USD", ["EUR", "GBP"])
print(rates["rates"]["EUR"])

client.convert("USD", "EUR", 100)                 # Pro+
client.historical("2026-01-15", "USD", ["EUR"])   # Pro+
client.timeseries("2026-01-01", "2026-01-31")     # Business+
client.crypto(["BTC", "ETH"])                      # Pro+
client.health()                                    # public

try:
    client.timeseries("2020-01-01", "2026-12-31")
except RateApiError as e:
    print(e, e.status)   # "Date range too large. Maximum is 366 days." 400
```

## v2 features

The client exposes the v2 endpoints directly (they resolve to `/api/v2` regardless of base URL):

```python
# Latest with 24h change, metadata and precision
r = client.latest_v2("USD", ["EUR", "GBP"], include_change=True, include_metadata=True, precision=4)
print(r["changes_pct"]["EUR"])

# Historical comparison between two dates (Pro+)
cmp = client.historical_compare("2026-01-15", "2026-01-01", "USD", ["EUR"])

# Batch conversion — up to 100 pairs in one call (Pro+)
batch = client.batch_convert([
    {"from": "USD", "to": "EUR", "amount": 100},
    {"from": "GBP", "to": "JPY", "amount": 50},
])

# Your configured rate alerts (Business+)
alerts = client.alerts()
```

## License

MIT
