An Apache Airflow data pipeline that fetches currency exchange rates from the National Bank of Poland (NBP) API, processes the data, and stores it in a MySQL database.
- Daily automated fetching of currency exchange rates
- Data transformation and cleaning pipeline
- UTC timestamp tracking for each data point
- MySQL database storage
- Error handling and retry mechanisms
- Email notifications on failure
The pipeline consists of several tasks:
fetch_currencies: Retrieves current exchange rates from NBP APItransform_currency_data: Processes and formats the raw dataadd_time_and_metadata: Adds timestamps and source informationvalidate_and_clean_data: Removes duplicates and invalid entriessave_to_mysql: Stores processed data in MySQL database
- Docker and Docker Compose
- Python 3.x
- MySQL Server
- WSL (if running on Windows)
Create a .env file based on env.example with the following variables:
AIRFLOW_UID=50000
COINGECKO_API_URL=https://api.coingecko.com/api/v3/simple/price
POSTGRES_CONN=postgresql://<USER>:<PASS>@postgres:5432/airflow
SMTP_HOST=<YOUR_SMTP_HOST>
SMTP_PORT=<YOUR_SMTP_PORT>
SMTP_USER=<YOUR_SMTP_USER>
SMTP_PASSWORD=<YOUR_SMTP_PASSWORD>
SMTP_MAIL_FROM=<YOUR_EMAIL>
ADMIN_PASSWORD=<YOUR PASSWORD>
FERNET_KEY=<YOUR FERNET KEY>
LOCAL_USER_ID=1000
LOCAL_GROUP_ID=1000
wsl_ip=<YOUR_WSL_IP_OR_SYSTEM_IP>
- Clone the repository:
git clone <repository-url>
cd crypto-airflow-
Create and configure the
.envfile -
Start the containers:
docker-compose up -dTo develop in a containerized environment, this project includes a VS Code devcontainer configuration. Required extensions:
- Python
- Pylance
├── .devcontainer/ # Development container configuration
├── config/ # Airflow configuration
├── dags/ # Airflow DAG definitions
├── logs/ # Airflow logs
├── plugins/ # Airflow plugins
├── scripts/ # Utility scripts
├── .env.example # Example environment variables
├── docker-compose.yml # Docker services configuration
└── README.md # This file
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request