nanoXchange-py is a FIX-style message-driven Limit Order Book simulator, purpose-built in Python for rapid experimentation, educational exploration, and pre-production prototyping. It emulates the core mechanics of a trading exchange — including matching limit/market orders with price-time priority, managing multiple tickers, and dynamically evolving order books.
This simulator provides a launchpad for the future high-performance system nanoXchange (C++), and is ideal for quantitative developers, system designers, and exchange engineers looking to sharpen their edge or build novel infrastructure.
- 📈 Prototype order matching algorithms using FIX-style interfaces
- 🧠 Learn realistic exchange design patterns via Python OOP
- 🔁 Provide a stepping stone toward high-performance C++ deployments
- 🛠️ Build tools for testing HFT strategies and exchange logic
- FIX Protocol Emulation: All orders are submitted, parsed, and returned using a human-readable FIX-style protocol.
- Modular OOP Architecture:
Exchangeuses the Singleton Pattern for global stateCommandclasses follow the Command Pattern for encapsulated request handlingParserhandles encoding/decoding and acts as the protocol translator
- MatchEngine follows Separation of Concerns, isolating trade execution logic
- OrderBook uses heap-based priority queues for price-time management
- Clean extensibility for logging, networking, or analytics
- ✅ FIX-style order interface (e.g.
35=D|57=O1|39=AAPL|...) - ✅ Market and Limit order support
- ✅ Modular, extensible class-based architecture
- ✅ Matching logic based on price-time priority
- ✅ Clean separation of parsing, exchange, order book, and match engine
- ✅ Unit tests covering core command and matching components
- 🔧 Ready for integration with:
- UDP/TCP clients and servers
- Historical scenario replays
- GUI / REST APIs
git clone https://github.com/nanoXchange/nanoXchange-py.git
cd nanoXchange-py
make setup # Create & activate virtual environment
pip install -r requirements.txt
make run # Launch interactive CLI (TODO)Once inside the prompt, use FIX-style messages:
35=D|57=O1|39=AAPL|38=5|54=BUY|11=LIMIT|55=151.0
35=D|57=O2|39=AAPL|38=3|54=SELL|11=MARKET
35=8|39=AAPL
EXIT
35=D: Place order35=F: Cancel order35=8: Display order book
make testmake freeze
# runs: pip freeze > requirements.txt- FIX-based CLI with parsing + encoding
- Limit and market matching via MatchEngine
- Command-based architecture (Add, Cancel, Display)
- CI workflow + pre-commit hooks (
black,ruff) - Add structured event logger
- Add scenario replay tool (JSON/CSV)
- Add support for batch orders
- Add UDP networking interface
- Add trade log ingestion + replay
- Port core engine to high-performance
nanoXchange(C++) - Connect bots and client APIs to simulation
- Simulate real market dynamics and microstructure
We welcome contributions from quant devs, exchange engineers, and curious hackers.
- Fork this repo
- Create a new feature branch
- Submit a pull request with clear commits and passing tests
This project is licensed under the MIT License. See LICENSE.
- Inspired by professional matching engine architecture
- Designed for education, experimentation, and performance evolution
- Built by:
📧 Questions or collaboration ideas?
📂 Open an Issue
🚀 Stay tuned for the C++ version: nanoXchange