Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High-Performance Java Matching Engine

A fast, stateful, event-driven Order Matching Engine written in core Java. It features a live "Binance-style" dark-mode UI, Price-Time priority matching, TCP-based distributed order ingestion, and real-time SQLite persistence.

Features

  • Live Order Book UI: A Java Swing dashboard featuring a dark theme, real-time quantity updates, order removal, and live search filtering.
  • Price-Time Priority Engine: Matches Bids and Asks natively using fast Priority Queues.
  • O(1) Order Cancellations: Uses a backing HashMap (orderLookup) to pluck cancelled orders out of the book instantly.
  • TCP Socket Ingestion: Accepts concurrent TCP connections from multiple remote NodeClient instances.
  • Sequence Buffering: Handles network jitter by re-ordering incoming packets sequentially before passing them to the engine.
  • Asynchronous Persistence: Uses a background StorageLayer thread to batch-save executed TradeRecords to an SQLite database without blocking the matching engine.
  • Historical Data Loading: Automatically loads previous trade history into the UI on startup.

Prerequisites

  1. Java Development Kit (JDK): Java 8 or higher installed.
  2. SQLite JDBC Driver: Required for saving trades to the database.

Download the SQLite JDBC Driver

You need to download the .jar file to allow Java to talk to SQLite.

  1. Go to the Xerial SQLite-JDBC Releases page: https://github.com/xerial/sqlite-jdbc/releases
  2. Download the latest jar (e.g., sqlite-jdbc-3.45.2.0.jar).
  3. For the commands below, place the downloaded .jar file directly into your project folder alongside your .java files.

How to Compile & Run (macOS / Linux)

Open your terminal and navigate to the project folder.

1. Compile the Code

Compile all .java files while linking the SQLite JDBC jar in the classpath. (Note: Replace sqlite-jdbc-3.45.2.0.jar with your exact downloaded filename if different).

Terminal 1:
javac -cp ".;sqlite-jdbc-3.53.0.0.jar" *.java
java -cp ".;sqlite-jdbc-3.53.0.0.jar" MatchingEngineServer

Terminal 2:
java NodeClient Node-1 200

Terminal 3:
java NodeClient Node-2 200

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages