$ show javifalces/HFTFramework
This repository is a high-frequency trading (HFT) research and development framework, primarily written in Java with a significant Python layer for reinforcement learning and data analysis. The actual system provides a modular architecture for backtesting and live execution of algorithmic trading strategies across multiple exchanges (Binance, Interactive Brokers, Kraken, MetaTrader). It supports market making algorithms (Avellaneda-Stoikov, ConstantSpread), factor investing, and a wide range of execution algorithms (TWAP, VWAP, Implementation Shortfall). Reinforcement learning integration is a key feature, with Gymnasium environments communicating via ZeroMQ to Java-based RL agents. The data pipeline ingests tick-level depth and trade data from Parquet/CSV files or live streams, generates OHLCV candles, and feeds into both traditional backtesting and RL training loops. While the framework is functionally rich and demonstrates advanced patterns (Disruptor ring buffers, object pools, time-series utilities), the codebase suffers from maintenance drift: many third-party libraries are vendored or outdated, hardcoded paths are scattered, and several modules contain commented-out or incomplete code. The project is a hybrid of a production-like trading engine and research code, with the dominant character being an application framework for algorithmic trading research.
The LLM identified 3 files worth highlighting for reuse:
A bounded, generic queue that maintains a fixed-size window of elements and provides efficient time-series operations such as percentage change, log return, and forward-fill. This class is self-contained, has no external dependencies beyond standard Java, and can be extracted as a standalone utility for any time-series data processing task.
Implements the ConnectorPublisherProvider interface using LMAX Disruptor ring buffers for low-latency event distribution. The pattern is decoupled from the trading domain and can be reused in any high-throughput event-driven system. It demonstrates a clean ring-buffer producer-consumer pattern with backpressure handling.
Provides reusable statistical functions for time-series data, including mean, variance, z-score, Hampel score, and cross-instrument z-score computation using forward-fill merging. The methods are static, operate on Double arrays or generic queues, and are independent of the trading context, making them extractable for any data analysis pipeline.