ExchangeQuest is a simple client-server trading exchange system that allows users to trade USD for RUB. This project demonstrates the implementation of a multi-client trading system with order matching logic using C++20. It leverages Boost.Asio for networking and GoogleTest for testing.
- Boost.Asio (latest stable version)
- CMake (version 3.21 or later)
- C++20 or later
- GoogleTest (for testing)
To build the project, follow these steps:
make
To run the server:
./build/server/ExchangeQuestServer
To run the client:
./build/client/ExchangeQuestClient
The project includes unit tests for order matching and other functionalities. To run the tests, follow these steps:
make tests
Start the server:
./build/server/ExchangeQuestServer
Start the client:
./build/client/ExchangeQuestClient
When you start the client, you'll be presented with a menu. Choose the option to connect to the server by selecting 1
.
--------------------------------------------------------------
| Exchange 1.0 |
--------------------------------------------------------------
--------------------------------------------------------------
| Select menu item |
--------------------------------------------------------------
| 0. Exit |
| 1. Connect to the server |
| 2. Registration |
| 3. Login |
| 4. Order |
| 5. Balance |
--------------------------------------------------------------
To register, select option 2
.
--------------------------------------------------------------
| Select menu item |
--------------------------------------------------------------
| 0. Exit |
| 1. Connect to the server |
| 2. Registration |
| 3. Login |
| 4. Order |
| 5. Balance |
--------------------------------------------------------------
After registration, you can log in by selecting option 3
and entering your UID.
--------------------------------------------------------------
| Select menu item |
--------------------------------------------------------------
| 0. Exit |
| 1. Connect to the server |
| 2. Registration |
| 3. Login |
| 4. Order |
| 5. Balance |
--------------------------------------------------------------
Enter UID:
To create a new trading order, select option 4
and follow the format for entering your order details.
--------------------------------------------------------------
| Select menu item |
--------------------------------------------------------------
| 0. Exit |
| 1. Create a new trading order |
| Format: [INSTRUMENT]|[SIDE]:[VOLUME]@[PRICE] |
| INSTRUMENT: Trading instrument (e.g., USD) |
| SIDE: BUY (for buying) or SELL (for selling) |
| VOLUME: Number of units to trade |
| PRICE: Price per unit |
| |
| Example: USD|BUY:[email protected] |
--------------------------------------------------------------
Enter your order:
To check your balance, select option 5
.
--------------------------------------------------------------
| Select menu item |
--------------------------------------------------------------
| 0. Exit |
| 1. Connect to the server |
| 2. Registration |
| 3. Login |
| 4. Order |
| 5. Balance |
--------------------------------------------------------------
Checking balance...
This project is licensed under the MIT License. Feel free to modify and distribute it as per the terms of the license.