Metadata-Version: 2.3
Name: currency-convert
Version: 0.1.0
Summary: A simple library to convert an amount from one currency to another with rates updated daily. Powered by the Exchange API created by Fawaz Ahmed https://github.com/fawazahmed0/exchange-api
Author: Faisal
Author-email: Faisal <faisal@nihongoproject.com>
Requires-Dist: requests>=2.34.2
Requires-Python: >=3.14
Description-Content-Type: text/markdown

# Currency Converter Script

A lightweight Python tool that performs currency conversions using daily updated exchange rates. It fetches data from the open-source currency API developed by Fawaz Ahmed via the jsDelivr CDN.

**Financial Disclaimer:** This script uses daily cached exchange rates. It does not update in real-time and is not suitable for live financial trading or transactional environments.

---

## Features

* **Daily Rates:** Automatically fetches exchange rates matching your system's current date.
* **Format Ready:** Outputs currency values as clean, comma-separated strings rounded to 2 decimal places.
* **Error Handling:** Built-in protection against invalid or unavailable currency codes.
* **Case Insensitive:** Accepts both uppercase and lowercase currency codes (e.g., `CAD`, `cad`, `Cad`).

---

## 🛠️ Prerequisites & Tech Stack

* **Language:** Python 3.12 or later
* **Libraries:** `requests` (external HTTP library)

### Install Dependencies

Before running the script, ensure you have the `requests` library installed:

```bash
pip install requests
```

---

## Usage & API Reference

### `current_rates(amount, input_currency, output_currency)`

Fetches the exchange rate for the current date and returns a formatted conversion string.

#### Parameters
* **`amount`** (`float` | `int`): The numerical value of the currency you want to convert.
* **`input_currency`** (`str`): The 3-letter ISO code for the base currency (e.g., `"cad"`).
* **`output_currency`** (`str`): The 3-letter ISO code for the target currency (e.g., `"jpy"`).

#### Return Value
* Returns a formatted `str` representing the converted amount (e.g., `"10,450.50"`), or an error message string (`"Currency not available"`).

---

## Quickstart Examples

You can import and run the function directly in your Python workflow:

```python
# Example 1: Converting a whole number (100 CAD to JPY)
result_1 = current_rates(100, "cad", "jpy")
# Output: Prints and returns the converted formatted string

# Example 2: Converting a precise decimal number (540.65 CAD to JPY)
result_2 = current_rates(540.65, "CAD", "JPY")
```

---

## Limitations & Data Sources

* **No Real-Time Tracking:** Rates are updated once per day by the data provider.
* **System Clock Dependency:** The script relies on `datetime.date.today()`. Ensure your system time is accurate to pull the correct daily file.
* **Data Provider:** Powered by the [@fawazahmed0/currency-api]([(https://github.com/fawazahmed0/exchange-api])).
