Skip to content

A trading simulator between a Broker and a Stock Exchange using the Financial Information eXchange (FIX) Protocol. It's a study project using QuickFIX/J, Quarkus, Angular, Docker, Docker Compose and PostgreSQL.

License

Notifications You must be signed in to change notification settings

felipewind/fix-trading-simulator

Repository files navigation

Fix Trading Simulator

Overview

A trading simulator between a Broker and a Stock Exchange using the Financial Information eXchange (FIX) Protocol. It's a study project using QuickFIX/J, Quarkus, Angular, Docker, Docker Compose and PostgreSQL.

If you want to participate on this project, just open an issue and we can talk about!

Both Broker and Exchange systems were built with Quarkus on the back-end and Angular on the front-end.

The back-ends communicate each other with QuickFIX/J and each has a schema into the PostgreSQL.

Each Angular front-end communicates with the Quarkus back-end using REST and Websockets.

System Architecture

image

Project Structure

Broker back-end

Broker front-end

Exchange back-end

Exchange front-end

Documentation

Features

Orders

You can submit, negotiate, cancel and list your orders.

It's possible to set the Exchange to automatically negotiate the orders.

Every change in the orders are broadcasted using websockets and are imeaditelly updated on the front-end.

Session

Make logon and logout.

View the session status and storage.

View the session configuration.

List the messages sent from the session.

Logs

List the FIX events.

List the messages received and sent.

Running the project

With docker-compose

After start, access project at:

The containers should be running like this:

docker ps
CONTAINER ID        IMAGE                               COMMAND                  CREATED             STATUS              PORTS                    NAMES
8191a0fcde2f        felipewind/exchange-front-end:1.0   "/docker-entrypoint.…"   16 minutes ago      Up 16 minutes       0.0.0.0:90->80/tcp       exchange-front-end
1178d4e1c02f        felipewind/broker-front-end:1.0     "/docker-entrypoint.…"   16 minutes ago      Up 16 minutes       0.0.0.0:80->80/tcp       broker-front-end
2370c47d0a2d        felipewind/broker-back-end:1.0      "/deployments/run-ja…"   16 minutes ago      Up 16 minutes       0.0.0.0:8080->8080/tcp   broker-back-end
8106b9a48217        felipewind/exchange-back-end:1.0    "/deployments/run-ja…"   16 minutes ago      Up 16 minutes       0.0.0.0:8090->8090/tcp   exchange-back-end
6b53a07b72ac        postgres                            "docker-entrypoint.s…"   16 minutes ago      Up 16 minutes       0.0.0.0:5432->5432/tcp   fix-trading-simulator_postgresql-qfj_1

Using the Docker Hub Images

Inside the root folder of the project, execute:

$ chmod +x ./run-from-docker-hub.sh
$ ./run-from-docker-hub.sh

Docker Hub images:

Building the Docker images locally

Inside the root folder of the project, execute:

$ chmod +x ./run-with-local-build.sh
$ ./run-with-local-build.sh

After the first build, you can use the run-after-local-build script.

Without docker-compose

The default version of the development back-end projects is using H2 data base (in memory).

It's possible to change the application.properties and set them to run with PostgreSQL, in this case you should start a PostgreSQL container:

docker run -d --name postgres-qfj -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres postgres

Enter inside the exchange-back-end folder and type:

$ ./mvnw compile quarkus:dev -Ddebug=5006

Access http://localhost:8090/q/swagger-ui/

Enter inside the broker-back-end folder and type:

$ ./mvnw compile quarkus:dev

Access http://localhost:8080/q/swagger-ui/

Enter inside the exchange-front-end folder and type:

$ npm install
$ ng serve

Access http://localhost:4300

Enter inside the broker-front-end folder and type:

$ npm install
$ ng serve

Access http://localhost:4200

Images

Session Control

image

Session Properties

image

Session Messages

image

Orders list

Broker

image

Exchange

image

Logs - FIX Events

image

Logs - Messages incoming

image

Broker - Swagger

image

Exchange - Swagger

image

Help Queries

select * from broker.sessions;
select * from broker.messages;
select * from broker.event_log  order by id desc;
select * from broker.messages_log_incoming order by id desc;
select * from broker.messages_log_outgoing order by id desc;

select * from exchange.sessions;
select * from exchange.messages;
select * from exchange.event_log  order by id desc;
select * from exchange.messages_log_incoming order by id desc;
select * from exchange.messages_log_outgoing order by id desc;

About

A trading simulator between a Broker and a Stock Exchange using the Financial Information eXchange (FIX) Protocol. It's a study project using QuickFIX/J, Quarkus, Angular, Docker, Docker Compose and PostgreSQL.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published