Exchange Simulator is an advanced simulation platform designed to model core functionalities of a financial exchange. It includes a matching engine and portfolio management components, making it a valuable tool for quantitative researchers, algorithmic traders, and developers interested in exchange infrastructure.
- 🚀 Matching Engine — Simulates real-time order matching for efficient trade execution.
- 📊 Portfolio Management — Tracks and manages simulated user portfolios based on executed trades.
- 🔄 Exchange Data Integration — Utilizes realistic or synthetic exchange data for accurate testing.
- 🧩 Modular Design — Easily extend or integrate new components for custom workflows.
- 🧪 Research & Testing Friendly — Suitable for development, backtesting, and academic research.
- 🛢️ PostgreSQL Support — Store exchange and portfolio data persistently using PostgreSQL.
- Python 3.8 or higher
- PostgreSQL 13 or higher (local or via Docker)
- (Optional) pipenv or
venvfor virtual environments - (Optional) Docker and Docker Compose for containerized deployment
-
Clone the repository:
git clone https://github.com/fifisayad/ExchangeSimulator.git cd ExchangeSimulator -
Install dependencies:
pip install -r requirements.txt
The following dependencies are required to connect to and use PostgreSQL:
psycopg2-binary sqlalchemyThese should be listed in your
requirements.txt. If not, add them:pip install psycopg2-binary sqlalchemy
-
Local PostgreSQL installation:
Install PostgreSQL by following the official instructions, create a database (e.g.,exchange_simulator), and update your project’s configuration to include:DB_HOSTDB_PORTDB_USERDB_PASSWORDDB_NAME
-
Or, use Docker Compose as described below.
-
Configure simulation parameters and database connection in your config files or environment.
-
Run the main simulation script (locally):
python main.py
Or inside Docker Compose:
docker-compose up
-
Review the simulation outputs for exchange activities and portfolio analytics.
For detailed usage guides and tutorial notebooks, see the Documentation section below.
ExchangeSimulator/
├── data/ # Exchange data samples and synthetic generators
├── engine/ # Core matching engine code
├── portfolio/ # Portfolio management logic
├── tests/ # Unit tests and simulation scenarios
├── utils/ # Utility functions and helpers
├── requirements.txt # Python dependencies (includes psycopg2-binary, sqlalchemy)
├── Dockerfile # Container build definition (if present)
├── docker-compose.yml # Sample compose file for Dockerized workflow
└── main.py # Entry point for the simulator
Comprehensive documentation including architecture details, component walkthroughs, and setup instructions can be found here:
👉 Exchange Simulator — Full Documentation (Notion)
Please consult this for design rationale, API reference, and advanced usage.
Contributions are welcome! Please open issues or submit pull requests for feature requests, bug fixes, or improvements.
- Fork this repo
- Create your feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -am 'Add awesome feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.