Skip to content

ExchangeQuest is a C++ client-server trading exchange system for USD and RUB with order matching, supporting multiple clients and real-time balance updates.

License

Notifications You must be signed in to change notification settings

Astrodynamic/ExchangeQuest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExchangeQuest

Introduction

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.

Requirements

  • Boost.Asio (latest stable version)
  • CMake (version 3.21 or later)
  • C++20 or later
  • GoogleTest (for testing)

Building and Running

To build the project, follow these steps:

make

To run the server:

./build/server/ExchangeQuestServer

To run the client:

./build/client/ExchangeQuestClient

Testing

The project includes unit tests for order matching and other functionalities. To run the tests, follow these steps:

make tests

Usage

1. Starting the Client and Server

Start the server:

./build/server/ExchangeQuestServer

Start the client:

./build/client/ExchangeQuestClient

2. Connecting to the Server

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                                                   |
 --------------------------------------------------------------

3. Registering a User

To register, select option 2.

 --------------------------------------------------------------
|                       Select menu item                       |
 --------------------------------------------------------------
| 0. Exit                                                      |
| 1. Connect to the server                                     |
| 2. Registration                                              |
| 3. Login                                                     |
| 4. Order                                                     |
| 5. Balance                                                   |
 --------------------------------------------------------------
 

4. Logging In

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:

5. Creating a Order

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:100@150.25                               |
 --------------------------------------------------------------

Enter your order:

6. Checking Balance

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...

LICENSE

This project is licensed under the MIT License. Feel free to modify and distribute it as per the terms of the license.