A Python-based automation tool designed to extract 365-day historical exchange rate datasets for audit and compliance. Features built-in API throttling, support for exotic African currency pairs (ZAR, BWP, MWK), and standardized Excel export.
# Forex Rate Extractor
A Python-based Streamlit application to extract and audit historical foreign exchange rates using the Twelve Data API.
🌐 **Live App**: fxtest.streamlit.app
## Features
### 📊 Rate Extraction
* **Historical Data**: Fetches exchange rates for requested currency pairs and date ranges.
* **Cross-Rate Calculation**: Automatically calculates cross-rates (e.g., ZAR → BWP) via USD.
* **Export Options**: Download results as CSV or Excel.
### 🔍 Audit & Reconciliation
* **Rate Validation**: Upload your own rates file and compare against official Twelve Data API rates.
* **Flexible Schema**: Supports various column naming conventions (Date, Base, Source, Rate).
* **Variance Detection**: Marks rates as PASS or EXCEPTION based on configurable threshold.
* **Testing Mode**: Use mock data to test without consuming API credits.
* **Smart Rate Limiting**: Respects Twelve Data's free tier limits (8 req/min).
## Quick Start
### Access via Streamlit Cloud (Recommended)
Visit fxtest.streamlit.app — no installation required!
### Running Locally
```bash
# Clone the repository
git clone
github.com
cd FXtest
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the app
streamlit run src/forex/main.py
```
### Running with Docker
```bash
docker-compose up --build
```
**Default URL**: `
localhost`
## Project Structure
```
FXtest/
├── src/forex/ # Main Python Package
│ ├── main.py # App entry point (Auth, Nav, Page Config)
│ ├── facade.py # High-level API for rate fetching
│ ├── auditor.py # Audit & reconciliation module
│ ├── api_client.py # Twelve Data API client with rate limiting
│ ├── data_processor.py # Data transformation & cross-rate calculation
│ ├── cache.py …