File size: 1,953 Bytes
20c801a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Currency Converter Web App

## Author:
- **Name**: [Your Name]
- **Student ID**: [Your Student ID]

## Project Description:

This project is a Currency Converter web app built using Python and Streamlit. It allows users to convert between different currencies using both the latest and historical exchange rates retrieved from the Frankfurter API.

### Key Features:
1. Convert an amount between two currencies using the latest conversion rate.
2. Convert an amount using a historical exchange rate for a selected date.
3. Display the conversion rate, converted amount, and inverse conversion rate.

### Files in the Project:
- **app.py**: Main Streamlit Python script used for managing users’ inputs and displaying results.
- **api.py**: Python script that contains the code for making API calls to fetch available currencies.
- **frankfurter.py**: Python script containing functions for calling relevant Frankfurter endpoints and extracting information (latest and historical rates).
- **currency.py**: Python script used for formatting the results displayed in the Streamlit app.
- **README.md**: Project documentation with details, functions list, and instructions for running the web app.

### Python Functions:
- `get_currencies()`: Fetches the list of available currencies from the Frankfurter API.
- `get_latest_rate(from_currency, to_currency)`: Fetches the latest conversion rate from the Frankfurter API.
- `get_historical_rate(from_currency, to_currency, date)`: Fetches the historical conversion rate for a specific date from the Frankfurter API.
- `format_conversion_result(date, from_currency, to_currency, rate, from_amount, to_amount, inverse_rate)`: Formats the conversion results for display in the Streamlit app.

### How to Run the Web App:
Install the required dependencies:

```bash
pip install streamlit requests
              or
pip install -r requirements.txt
```

Run the Streamlit app:

```bash 
streamlit run app.py
```