This is a monorepo for the SEAK project. This project comes from a PFE (Projet de Fin d'Études) at the Télécom SudParis.
The goal of this project is to emulate a financial market with a broker which allows you to buy and sell stocks at market price, place limit orders inside the order book and get the market data in real time.
A cli.sh script is available at the root of the project to help you to use the project.
$> ./cli.shSource the ./cli_autocomplete.sh file to enable the autocompletion of the cli.sh script.
$> source ./cli_autocomplete.sh- Java 17
- Docker
- Python 3.11
- Poetry
The first step is to install all the sub projects.
- Website backend
$> cd components/website-backend; poetry install- Website frontend
$> cd components/website-frontend; npm install- Quickfix client
$> cd clients/quickfix-client; poetry install- GUI client
$> cd clients/graphical-user-interface; poetry installThen you need to setup the docker environment for the broker. You need to choose between a kafka with a single node or a kafka with a cluster of 3 nodes.
- Single node
$> ./cli.sh docker start- Cluster
$> ./cli.sh docker_multi startThose commands will start the kafka cluster and adjust the config files for the broker to use the kafka cluster.
Setup the environment variables for the websites components.
- Website frontend
$> cd components/website-frontend; cp .env.sample .env.productionThen you need to fill the .env.production file with the correct values, especially the NEXTAUTH_SECRET which can be generated with the following command:
$> openssl rand -hex 64- Website backend
$> cd components/website-backend; cp .env.sample .envThen you need to fill the .env file with the correct values. You must use the same NEXTAUTH_SECRET as the frontend for the SECRET_KET.
Finnaly migrate the DB to create the tables and add the base accounts:
$> cd components/website-backend; ENVIRONMENT=production poetry run python app/command.py initThe last step is to run the project, befaure lauchning project with the cli script deactivate any python virtual environment in your current shell.
The first step is to launch the pre-processing for the market data.
$> ./cli.sh project pre-processingThen you can start the different components of the project.
- Quickfix server
$> ./cli.sh project quickfix-server- Order Stream
$> ./cli.sh project order-stream- Market Matcher
$> ./cli.sh project market-matcher- Order Book
$> ./cli.sh project order-book- Trade Stream
$> ./cli.sh project trade-streamFinnaly you can start the website components.
- Website backend
$> ENVIRONMENT=production ./cli.sh project website-backend- Website frontend
$> ./cli.sh project website-frontend build
$> ./cli.sh project website-frontend startBefore using the GUI client, you need to register clients and enables them using the website.
Go to http://localhost:3001/register and register any clients you want to use.
Then go to http://localhost:3001/account/users and authenticate using the admin account. You can now enable the clients you want to use and set them some money they can use to buy stocks.
You can now use the GUI client to interact with the broker.
$> cd clients/graphical-user-interface; poetry run python quickfix_client_gui/run_interface.pyIn cas you need to change the ip of the quickfix server, you need to modify this file clients/quickfix-client/broker_quickfix_client/constant.py withe SERVER_IP variable.
All the components are tested with unit tests and integration tests which you can launch using the cli script.
$> ./cli.sh project <component> testThe project is monitored with prometheus and grafana. You can access the grafana dashboard at http://localhost:3000 with anonymous access.
You will have dashboards for kafka cluster and the different components of the project.
Check the Grafana documentation for more information.

