This project is a web application that allows users to track and visualize relative changes in currency exchange rates for various countries over a selected date range. The application is built using Python, following an Object-Oriented Programming (OOP) approach, and runs within its own virtual environment.
- Currency Rate Fetching: Fetches exchange rates for USD, EUR, GBP, JPY, TRY, INR, and CNY for a user-specified date range from finmarket.ru.
- Country Currency Data: Retrieves and updates the list of world currencies from iban.ru.
- Data Synchronization: Synchronizes fetched data with a local SQLite database, ensuring only changed or new records are updated.
- Relative Rate Calculation: Calculates and stores relative changes in exchange rates for each country, based on a user-selected reference date.
- Interactive Web Interface: Users can visualize relative changes in currency rates for selected countries over a chosen date range.
- Python 3.7+
- Virtual Environment (
venv) - Internet connection for fetching data
-
Clone the Repository:
git clone https://github.com/qwer112358/python_intern.git cd currencyProject -
Set up the Virtual Environment:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Dependencies:
pip install -r requirements.txt
-
Run the Web Application:
python manage.py runserver
-
Access the Application:
Open your web browser and navigate to
http://127.0.0.1:8000/. -
Interact with the Interface:
- Select a date range to fetch currency exchange rates.
- Choose countries and date ranges to visualize relative changes in currency rates.
main/models.py: Contains the database models for storing currency and country data.main/views.py: Handles web requests and responses, rendering HTML templates.main/utils/scraper.py: Contains classes and methods for fetching and processing data from external sources.main/utils/SyncDB.py: Contains logic for calculating relative currency changes.main/utils/CurrencyPlot.py: Handles the creation and encoding of plots for visualizing relative changes in currency rates using Matplotlib and Pandas.main/templates/: HTML templates for the web interface.
Here is an example of a plot generated by the CurrencyPlot class, showing the relative changes in currency rates:
To see plots in action, run the application and navigate to the visualization interface where you can select countries and date ranges to generate similar plots.
