Metadata-Version: 2.4
Name: afxapicom
Version: 0.1.1
Summary: Async Python client for currency exchange rates
License-Expression: MIT
Project-URL: Homepage, https://github.com/MrBaconHat/afxapi-python
Project-URL: Repository, https://github.com/MrBaconHat/afxapi-python
Keywords: exchange rates,currency,forex,async,api
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Framework :: AsyncIO
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: aiohttp>=3.9

# afxapicom

An unofficial async Python client for currency exchange rates.

## Installation

Install from pip:
```sh
pip install afxapicom
```

Install from source:
```sh
pip install git+https://github.com/MrBaconHat/afxapi-python.git
```

## Usage

All requests are made using the `Client` class, initialized with your API key.

```python
import afxapicom
import asyncio

async def main():
    client = afxapicom.Client('YOUR_API_KEY')
    # make calls here

asyncio.run(main())
```

### Check API Status

```python
result = await client.status()
print(result)
```

### Retrieve Currencies

```python
result = await client.currencies(currencies=['EUR', 'USD'])
print(result)
```

### Latest Exchange Rates

```python
result = await client.latest(base_currency='USD', currencies=['EUR', 'GBP'])
print(result)
```

### Historical Exchange Rates

```python
result = await client.historical('2024-01-01', base_currency='USD')
print(result)
```

### Exchange Rates Over a Range

```python
result = await client.range('2024-01-01', '2024-01-07', base_currency='USD')
print(result)
```

### Convert Currencies

```python
result = await client.convert(1000, base_currency='USD', currencies=['EUR', 'GBP'])
print(result)
```

## Error Handling

```python
from afxapicom import Client
from afxapicom.errors import AuthenticationFailed, RateLimited, QuotaExceeded

async def main():
    client = Client('YOUR_API_KEY')
    try:
        result = await client.latest()
        print(result)
    except AuthenticationFailed:
        print("Invalid API key")
    except RateLimited:
        print("Rate limit hit, slow down")
    except QuotaExceeded:
        print("Monthly quota exceeded")

asyncio.run(main())
```
