A Java-based FIX protocol trading simulator. It acts as a FIX acceptor (exchange / broker stand-in) so you can configure a server, connect a client, send orders, and test sessions and matching behaviour without touching a live market.
- Features
- Project Goals
- Architecture at a Glance
- Getting Started
- Running the Simulator
- Connecting a FIX Client
- Configuration Reference
- Optional: MySQL Logging
- Usage Walkthrough
- Possible Implementations / Roadmap
- Project Layout
- Troubleshooting
| Area | What you get |
|---|---|
| π FIX Acceptor | Built on QuickFIX/J with a socket acceptor (default port 9878) |
| π§Ύ Order handling | Create, acknowledge, pend, cancel and replace orders |
| π± Executions | Fill / partial-fill orders manually or automatically |
| π£ IOIs | Indication-of-Interest messages |
| π Instruments | Load and manage instruments from config/instruments.xml |
| π Message logs | Inspect in-flight FIX messages in the UI, with optional file and DB logging |
| π Canned queries | Run prepared reports against the message / event store |
| βοΈ Auto-behaviour | Toggle auto-acknowledge, auto-cancel, auto-replace and auto-pending responses |
- Configure the server
- Run the server
- Connect to a client
- Perform trades
- Perform session tests
- Perform matching-engine tests
- Analyse real-world technologies
- Adopt new protocols such as ITCH, OUCH and SQF
ββββββββββββββββββββ FIX 4.2 over TCP ββββββββββββββββββββββββββββββ
β Your FIX client β βββββββββββββββββββββββββββΆ β FIXimulator (acceptor) β
β (e.g. BANZAI) β βββββββββββββββββββββββββββ β QuickFIX/J SocketAcceptor β
ββββββββββββββββββββ acks / fills / reports β + Swing control UI β
βββββββββββββββ¬βββββββββββββββ
β optional
βΌ
ββββββββββββββββββββββββββββββ
β File logs / MySQL (JDBC) β
ββββββββββββββββββββββββββββββ
Startup flow (FIXimulator β FIXimulatorFrame):
- Reads
config/FIXimulator.cfg(QuickFIX/JSessionSettings). - Loads instruments from
config/instruments.xml. - Builds the message store and log factories (screen, file, JDBC depending on settings).
- Starts the
SocketAcceptorand opens the Swing UI.
- A Java runtime capable of running
dist/FIXimulator_0.41.jar(a Swing desktop app; a display is required). - (Optional) MySQL if you want database logging.
- (Optional) NetBeans or Apache Ant if you want to rebuild from source. The project is configured with
javac.source=1.5innbproject/project.properties, so a legacy JDK may be needed to recompile.
| Path | Purpose |
|---|---|
dist/FIXimulator_0.41.jar |
Ready-to-run application |
dist/lib/ |
Runtime libraries (QuickFIX/J, MINA, SLF4J, MySQL connector, β¦) |
config/ |
Session and instrument configuration |
fiximulator.bat |
Windows launcher |
reset.bat |
Clears the data folder (session store) |
mysql/ |
SQL scripts for the optional database |
Using NetBeans, open the project and choose Clean and Build, or from the command line use the Ant build at the repository root:
ant clean jarThe output is written to dist/.
Important: run the application from the repository root. The configuration paths (
config/...,data,logs) are relative to the current working directory.
Linux / macOS
java -jar dist/FIXimulator_0.41.jarWindows
fiximulator.batOr:
java -jar dist\FIXimulator_0.41.jarWhen it starts you should see:
- The FIXimulator main window (Swing).
- The FIX acceptor listening on port
9878(set bySocketAcceptPort). - Log output in the console and, if enabled, under
logs/.
To wipe the local session store and start fresh, run reset.bat on Windows (or delete data/) while the simulator is stopped.
The default session is configured as:
| Setting | Value |
|---|---|
| Protocol | FIX 4.2 (BeginString=FIX.4.2) |
| Connection type | acceptor (FIXimulator listens) |
| Host | localhost |
| Port | 9878 |
| SenderCompID (FIXimulator) | FIXIMULATOR |
| TargetCompID (your client) | BANZAI |
| Heartbeat interval | 30 seconds |
| Session time window | 00:00:00 β 00:00:00 (always on) |
Your client must log on with SenderCompID = BANZAI and TargetCompID = FIXIMULATOR, using FIX 4.2 and a heartbeat of 30 s.
A minimal example from a FIX client's point of view:
8=FIX.4.2 | 35=A (Logon) | 49=BANZAI | 56=FIXIMULATOR | 98=0 | 108=30
Once the logon is accepted you can send NewOrderSingle (35=D) messages and receive execution reports (35=8).
To use a different counterparty, change TargetCompID / SenderCompID in config/FIXimulator.cfg (or use one of the alternate config files below) and restart.
The fixclient/ module is a console initiator built on QuickFIX/J that logs on to FIXimulator and places, replaces, and cancels orders.
cd fixclient
mvn -B package -DskipTests
java -jar target/fixclient-1.0.0-shaded.jar client.cfgAt the fix> prompt, type demo to run a scripted sequence (limit buy, limit sell, market buy, replace, cancel), or help for commands such as buy IBM 25 91.25, sell MSFT 10 MKT, replace <clOrdId> <qty> <px>, cancel <clOrdId>, and orders. Orders stay PENDING_NEW until you accept them in the FIXimulator UI, or you enable FIXimulatorAutoAcknowledge in config/FIXimulator.cfg.
Session commands: logon and logout control the session (logout is refused when already logged off), test [id] sends a TestRequest (requires a logged-on session; FIXimulator answers with a Heartbeat), seq shows the next outgoing and expected incoming sequence numbers, and reset resets sequence numbers to 1 (only while logged off). reset sends ResetSeqNumFlag=Y (141=Y) on the next logon. With ResetOnLogon=N, a logon with stale sequence numbers is rejected with "MsgSeqNum too low"; use reset and then logon to recover. Note that the FIXimulator acceptor keeps its own sequence state in its data/ directory, so delete that directory when you want to start from a clean state.
| File | Purpose |
|---|---|
config/FIXimulator.cfg |
Active configuration loaded at startup |
config/FIXimulator_BANZAI.cfg |
Preset for the BANZAI counterparty (port 9878) |
config/FIXimulator_MARKETC.cfg |
Preset for a MARKETC counterparty (port 7001) |
config/instruments.xml |
Full instrument list |
config/instruments_small.xml |
Smaller instrument list for quick tests |
To switch presets, copy the one you want over config/FIXimulator.cfg before starting.
| Key | Default | Meaning |
|---|---|---|
SocketAcceptPort |
9878 |
TCP port FIXimulator listens on |
BeginString |
FIX.4.2 |
FIX version |
DataDictionary |
FIX42.xml |
QuickFIX/J data dictionary |
HeartBtInt |
30 |
Heartbeat interval (seconds) |
StartTime / EndTime |
00:00:00 |
Session active window |
FileStorePath |
data |
Session store directory |
RefreshMessageStoreAtLogon |
Y |
Reset stored messages on logon |
FIXimulatorLogToFile |
N |
Write message logs to logs/ |
FIXimulatorLogToDB |
N |
Write logs to MySQL via JDBC |
FIXimulatorAutoAcknowledge |
N |
Automatically acknowledge new orders |
FIXimulatorAutoCancel |
N |
Automatically cancel orders |
FIXimulatorAutoReplace |
N |
Automatically accept replace requests |
FIXimulatorAutoPendingCancel |
N |
Automatically handle pending-cancel |
FIXimulatorAutoPendingReplace |
N |
Automatically handle pending-replace |
FIXimulatorSendOnBehalfOfCompID |
N |
Include OnBehalfOfCompID in outgoing messages |
FIXimulatorSendOnBehalfOfSubID |
N |
Include OnBehalfOfSubID in outgoing messages |
FIXimulatorPricePrecision |
4 |
Decimal places for prices |
FIXimulatorCachedObjects |
50 |
Number of cached objects |
| Key | Example | Meaning |
|---|---|---|
SenderCompID |
FIXIMULATOR |
This side's ID |
TargetCompID |
BANZAI |
Counterparty's ID |
FileLogPath |
logs |
Per-session log directory |
OnBehalfOfCompID |
BROKER |
Used when on-behalf-of is enabled |
OnBehalfOfSubID |
DESK |
Used when on-behalf-of is enabled |
Use this only if you set FIXimulatorLogToDB=Y.
-
Start MySQL and create the schema and user from
mysql/:cd mysql ./create.sh # Windows: create.bat
create.shrunsmysql.sql, which loads thequickfixschema, thefiximulatoruser and the table definitions (messages_table.sql,sessions_table.sql,event_log_table.sql,messages_log_table.sql, β¦). -
Confirm the JDBC settings in
config/FIXimulator.cfgmatch your setup:JdbcURL=jdbc:mysql://localhost:3306/quickfix JdbcUser=fiximulator JdbcPassword=fiximulator JdbcDriver=com.mysql.jdbc.Driver
β οΈ The default credentials are for local testing only. Change them before using the simulator anywhere shared.
| Step | Goal | How |
|---|---|---|
| 1 | Configure | Pick or edit a config in config/; set port and CompIDs |
| 2 | Run | Start the jar from the repo root |
| 3 | Connect | Log on from your FIX client (BANZAI β FIXIMULATOR, port 9878) |
| 4 | Trade | Send NewOrderSingle; acknowledge, fill, cancel or replace from the UI or enable auto-behaviour |
| 5 | Session test | Exercise logon, heartbeats and logout; inspect logs in logs/ |
| 6 | Matching-engine test | Send bursts of orders against instruments.xml, verify fills and execution reports |
| 7 | Analyse | Review message logs and canned queries to study real-world FIX flows |
| 8 | Extend | Add new protocols (see below) |
These are directions the project can grow in. None are implemented yet.
- Headless mode β run the acceptor without the Swing UI, for CI pipelines and scripted tests.
- Scripted scenarios β describe a sequence of client actions and expected responses in a text file and replay it against the acceptor.
- Session test harness β automated checks for logon, heartbeat, sequence-number gaps and resend behaviour.
- Matching-engine test harness β a simple price-time-priority book so fills are deterministic and assertable.
- Upgrade the FIX dialect β support FIX 4.4 / 5.0 SP2 in addition to 4.2 by selecting
BeginStringand the matching data dictionary. - Configurable instruments and prices β generate
instruments.xmlfrom a CSV or market-data snapshot.
| Protocol | Typical use | Possible approach |
|---|---|---|
| ITCH | Market-data feed (order-book deltas) | Add a publisher module that replays order events from the matching engine |
| OUCH | Low-latency order entry / acknowledgement | Add a binary order-entry gateway alongside the FIX acceptor, sharing the same order model |
| SQF | Market-data / quote-stream format | Add a quote-stream encoder fed by the same instrument and book state |
For each protocol the suggested order of work is: define the message model, add an encoder/decoder with round-trip tests, wire it to the existing order and execution pipeline, then expose it through configuration (for example, a new config/*.cfg preset).
- Capture-and-replay of real FIX/ITCH traffic for latency and behaviour comparison.
- Exportable reports (CSV / JSON) from the message and event stores.
- Metrics for throughput, latency and fill rates.
FIXimulator/
βββ build.xml Ant build (imports nbproject/build-impl.xml)
βββ fiximulator.bat Windows launcher
βββ reset.bat Clears the session store
βββ config/ Session, preset and instrument configuration
βββ dist/ Built jar and runtime libraries
βββ lib/ Build-time libraries
βββ logs/ Session and message logs
βββ mysql/ Optional DB schema scripts
βββ nbproject/ NetBeans project metadata
βββ src/edu/harvard/fas/zfeledy/fiximulator/
βββ core/ FIX acceptor, orders, executions, IOIs, instruments
βββ ui/ Swing front end (FIXimulatorFrame and table models)
βββ util/ Logging and FIX message helpers
| Symptom | Likely cause / fix |
|---|---|
FileNotFoundException for config/FIXimulator.cfg on startup |
You started the jar from the wrong directory. Run it from the repo root. |
| Client cannot connect | Confirm the port (9878) is free and the simulator is running. Check firewall rules. |
| Logon rejected | SenderCompID / TargetCompID must be the reverse of what the simulator expects (client sends BANZAI, simulator is FIXIMULATOR). |
No logs in logs/ |
Set FIXimulatorLogToFile=Y. |
| DB logging fails | Check MySQL is running and the JdbcURL / user / password match mysql/fiximulator_user.sql. |
| Window does not open | The app is a Swing desktop application and needs a graphical display. |
FIXimulator is a learning and testing tool. It is not a production exchange and should not be connected to live trading systems.