Skip to content

thrishank/orders-matching-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Price Matching Engine

A high-performance price matching engine for Solana-based trading applications. It listens to on-chain events to a program, maintains an in-memory order book, and provides an API for querying the current state.

Features

  • Real-Time Event Processing: Listens to Solana on-chain events via WebSocket and processes them in real-time.
  • In-Memory Order Book: Maintains a high-performance, in-memory order book.
  • Order Management: Handles order creation, cancellation, updates, and fills.
  • HTTP API: Exposes an HTTP server to query the order book and system state.
  • Database Integration: Persists event history to a PostgreSQL database.

Installation

  1. Clone the repository:

    git clone https://github.com/thris/matching-engine.git
    cd matching-engine

Project Structure

The project is organized into several modules:

  • api.rs: Handles API requests.
  • engine.rs: The core matching engine logic.
  • events.rs: Event definitions and handling.
  • lib.rs: Crate root and utility functions.
  • main.rs: The main application entry point.
  • order.rs: Order-related data structures and logic.
  • price.rs: Price calculation and related functions.
  • processor.rs: Event processing and dispatching.
  • server.rs: The HTTP server implementation.
  • state.rs: Manages the application's state.
  • types.rs: Common data types used throughout the application.

Key Dependencies

  • tokio: Asynchronous runtime for Rust.
  • axum: Web application framework.
  • serde: Framework for serializing and deserializing Rust data structures.
  • solana-client: Solana RPC client.
  • sqlx: Asynchronous SQL toolkit for Rust.
  • tracing: A framework for instrumenting Rust programs to collect structured, event-based diagnostic information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages