Giter Site home page Giter Site logo

samuelguillemet / seak Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 3.68 MB

SEAK, emulates a financial broker which allows you to buy and sell stocks at market price, place limit orders inside an order book and get the market data in real time.

Java 44.37% Python 33.38% Shell 1.04% JavaScript 0.32% TypeScript 20.58% SCSS 0.31%

seak's Introduction

GitHub Release CodeQL CI - Java CI - Python CI - Node pre-commit

SEAK - Stock Exchange Application using Kafka

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.

Getting Started

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.

alt text

How to use the project

A cli.sh script is available at the root of the project to help you to use the project.

$> ./cli.sh

Source the ./cli_autocomplete.sh file to enable the autocompletion of the cli.sh script.

$> source ./cli_autocomplete.sh

Requirements

  • Java 17
  • Docker
  • Python 3.11
  • Poetry

Install the project

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 install

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

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

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

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

Run the project

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

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

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

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

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

Test the project

All the components are tested with unit tests and integration tests which you can launch using the cli script.

$> ./cli.sh project <component> test

Metrics

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

seak's People

Contributors

dependabot[bot] avatar samuelguillemet avatar theoj-a avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

seak's Issues

🚀 Possible Roadmap

Here is a description of a possible roadmap to extend the project:

  • Save quickfix-server messages id with Redis
  • Save order-book market data subscription to Redis
  • Save order-book order-book orders to Redis
  • Add routes to read and modify market data subscriptions
  • Add routes to read and reset order-book orders
  • Add init methods to load default value to the order-book

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.