This project includes a web-based chat application that allows users to query currency exchange rates from PrivatBank. The application includes a simple client interface and a WebSocket server to handle the requests.
- Fetch exchange rates for specified currencies and days.
- View available currencies.
- Log commands executed in the chat.
- Display command help on initial load.
index.html
: The main HTML file for the chat client interface.main.css
: CSS file for styling the chat client interface.main.js
: JavaScript file for handling WebSocket communication and client-side logic.main.py
: Python script for the console utility to fetch exchange rates.server.py
: Python script for the WebSocket server to handle chat commands and fetch exchange rates.
- Python 3.12+
- aiohttp
- aiofile
- aiopath
- websockets
- Clone the repository:
git clone https://github.com/your-username/currency-exchange-chat.git
cd currency-exchange-chat
- Install the required Python packages:
pip install aiohttp aiofile aiopath websockets
-
Start the WebSocket server:
python server.py
-
Fetch exchange rates for the last 2 days for EUR and USD:
python main.py 2 --currencies EUR USD
-
Open
index.html
in your web browser. -
The help section will display the available commands and currencies.
-
Use the chat input to enter commands, for example:
exchange 2 EUR USD