Skip to content

real-time data aggregator and trading system, capable of collecting, processing, and distributing market data to facilitate automated trading decisions.

Notifications You must be signed in to change notification settings

Eomaxl/HFT-DataAggregator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Aggregator (Stock Exchange Data)

This application is designed to function as a real-time data aggregator and trading system, capable of collecting, processing, and distributing market data to facilitate automated trading decisions. It integrates multiple protocols such as FIX, WebSocket, and REST APIs to manage real-time data streams, execute trades, and provide analytics. This system is ideal for use in financial markets where low latency and high concurrency are critical.

Use Cases

  • Real-Time Market Data Aggregation: The application collects live market data using WebSocket and REST APIs, aggregates it, and makes it available for trading algorithms.
  • Automated Trading: The FIX protocol is used for executing trades based on real-time data processed by the system.
  • Market Depth Analysis: Fetches order book data to provide insights into market liquidity and potential price movements.

APIs Exposed by the Application

1. Stock List API

  • Endpoint: http://127.0.0.1:8080/stocks
  • Method: GET
  • Query Parameters (all optional):
    • symbol: Filter by symbol (e.g., AAPL).
    • exchange: Filter by exchange name (e.g., NASDAQ).
    • mic_code: Filter by market identifier code (MIC) (e.g., XNAS).
    • country: Filter by country (e.g., United States).
    • type_: Filter by instrument type (e.g., Common Stock).
  • Example curl Command:
  • Example Response:
    • [ { "symbol": "AAPL", "name": "Apple Inc", "currency": "USD", "exchange": "NASDAQ", "mic_code": "XNAS", "country": "United States", "type_": "Common Stock" } ]
# Building and Running the Application Prerequisites
  • Rust : Ensure that Rust is installed on your machine. You can install Rust by following the instructions at rust-lang.org.
  • Cargo : Rust’s package manager, cargo, will be used to build and run the application.
Steps to Build and Run
Clone the Repository:
git clone https://github.com/your-repo/trading-system.git
cd trading-system
Create a .env File:

Create a .env file in the root of the project and add the following:

API_KEY=your_twelve_data_api_key FIX_SERVER_ADDRESS=127.0.0.1 FIX_SERVER_PORT=12345
Build the Application:
cargo build --release
Run the Application:
cargo run --release
The server will start and listen on http://127.0.0.1:8080.

Design Patterns Used

Actor Model:

Used in WebSocket handling via the actix framework, where each WebSocket connection is managed as an actor.

Factory Pattern:

Employed in creating and managing instances of clients like the TwelveDataAPI and FixSession.

Observer Pattern:

The broadcast channel in WebSocket and FIX sessions implements an observer pattern where multiple subscribers can receive updates.

Protocols Overview

WebSocket

Purpose: WebSockets provide full-duplex communication channels over a single TCP connection. In this application, WebSockets are used to receive real-time updates from market data providers and push them to connected clients.

FIX (Financial Information eXchange)

Purpose: FIX is a standardized protocol used for real-time electronic communication of financial transactions. The application uses FIX for executing trades and managing orders.

REST

Purpose: REST (Representational State Transfer) is an architectural style for designing networked applications. It uses HTTP requests to access and manipulate data.

About

real-time data aggregator and trading system, capable of collecting, processing, and distributing market data to facilitate automated trading decisions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages