HFTC Platform

SHIFT

The platform behind HFTC

What SHIFT Is

A market simulator built at Stevens that behaves like an electronic exchange.

SHIFT, the Stevens High Frequency Trading simulation system, is written in C++. Many students have developed it over the years at the Hanlon Financial Systems Center, advised by Dr. Ionut Florescu. It gives students and researchers a realistic place to test trading algorithms and to study how markets behave. The platform is described in the SHIFT paper by Alves, Florescu, Calhoun and Bozdog.

In development since
2014
Exchange core
C++
Messaging protocol
FIX 5.0 SP2
Order priority
Price-time

How it is built

The exchange is split into three modules, and users connect to it through a client. Each module can run as several copies when a deployment adds clients or tickers.

SHIFT architecture The Datafeed Engine, Matching Engine and Brokerage Center are linked by FIX connections. Historical data feeds the Datafeed Engine, shared libraries support the modules, and the Core Client connects to the Brokerage Center. The Python API and web interface are built on the Core Client. FIXFIXFIX Datafeed Engineloads historical data Matching Engineorders and cancellations Brokerage Centeraccounts and trade records Core ClientC++ interface Tick historyAPI and database Shared librariesLibMisc, QuickFIX Python and web clientsbuilt on the Core Client
How the SHIFT modules connect. Double arrows are two-way FIX connections.
  1. Exchange

    Datafeed Engine

    Loads historical market data, retrieved through a tick history API and stored in a database, and streams it to the Matching Engine.

  2. Exchange

    Matching Engine

    Receives and executes orders and cancellations. It keeps a limit order book for every ticker and fills orders by price, then time.

  3. Exchange

    Brokerage Center

    Manages user accounts and databases. It tracks portfolios and buying power, charges transaction fees, applies trading limits and margin calls, and stores every trade record.

  4. Client

    Core Client

    The C++ interface for submitting orders and querying data. The Python API and the web interface are built on it, and every client is an independent account that acts whenever it chooses.

The modules talk to each other over the Financial Information eXchange (FIX) protocol, the industry standard for electronic trading.

Where the orders come from

SHIFT can fill a market in two ways. HFTC combines them: participants trade against recorded market data, alongside simulated agents of two kinds.

Replay data

SHIFT rebuilds the order book from tick-level historical TAQ (trades and quotes) data. The historical orders sit in the Global Order Book, and orders submitted by users sit in the Local Order Book, so participants trade against recorded market liquidity. Liquidity is finite, so two identical orders sent at the same moment can fill differently depending on which reaches the Matching Engine first.

Simulated agents

In agent-based simulation, the market is made up of simulated agents and everything is recorded in the Local Order Book. Zero-intelligence (ZI) agents trade according to random distributions. Reinforcement-learning (RL) agents learn their trading behavior. The HFTC agents are inspired by the reinforcement learning agent-based market simulation paper by Yao, Li, Thomas and Florescu.

How realistic is it?

SHIFT's simulated prices have been compared with features documented in real markets. In a baseline test, 200 simple zero-intelligence agents traded one stock through a simulated 6.5-hour session, with no news and fixed strategies. Even so, the price series reproduced the following.

  • Negative autocorrelationin short-interval returns, caused by the bid-ask bounce
  • Heavy-tailed returnswith average excess kurtosis near 2 at one-second sampling
  • Volatility clusteringwith slowly decaying autocorrelation in squared returns
  • ARCH effectsdetected in every experiment
  • Order book shapewith depth that peaks a few ticks from the mid price and then decays

SHIFT has also been stress-tested. When extra traders sell a large block of shares partway through a session, the price drawdown depends on trading frequency, wealth distribution and sell-off size. These tests use simulated agents and are separate from competition play.

Where it is used

SHIFT supports Stevens courses on market microstructure and algorithmic trading, academic research, and the High Frequency Trading Competition, which runs on replay data together with ZI and RL agents. An earlier pilot competition at Stevens in spring 2019 had 38 students in 11 teams trading the 30 Dow Jones Industrial Average stocks over six weekly rounds. Publications that build on SHIFT are listed on the project page below.

Learn more

← Back to HFTC