A robust backtesting and live trading engine designed for seamless strategy development and deployment. It supports user-defined strategies, multi-threaded execution, and integrations with brokers and data sources.
Project description
MidasTrader
MidasTrader is a robust trading system designed for seamless transitions between backtesting and live trading without requiring changes to user code. It integrates a flexible architecture combining a data engine, execution engine, and core components that streamline the strategy development process. The system is built with a multi-threaded design where each component communicates via a shared message bus.
Key Components
-
Core Engine:
- Central to the system, the Core Engine includes:
- Order Book: Tracks market depth and price movements.
- Portfolio Server: Manages and tracks portfolio allocations and positions.
- Performance Tracking: Calculates and monitors key trading metrics.
- Order Management System: Handles order placement, modifications, and cancellations.
- Base Strategy: A foundation for user-defined strategies.
- Central to the system, the Core Engine includes:
-
Data Engine:
- Connects to user-defined data sources:
- Midas Server: Access historical data via the Midas ecosystem.
- Binary Data Files: Handles local files encoded with the Midas Binary Encoding Library.
- External Sources: Currently supports Databento, with more integrations planned.
- Connects to user-defined data sources:
-
Execution Engine:
- Facilitates live trading by connecting to brokers:
- Currently supports Interactive Brokers.
- Users can configure broker details in the
config.tomlfile.
- Facilitates live trading by connecting to brokers:
Installation
You can install midastrader directly from PyPI:
pip install midastrader
Configuration
Configuration File (config.toml)
Define system parameters, including data sources, execution settings, and strategy configuration.
- Example : config.toml
Strategy File (logic.py)
Strategies are implemented by extending the BaseStrategy class. Define your custom logic in Python.
- Example : logic.py
Usage
CLI Mode
Run the system using the following commands:
# Backtest Mode
midas path/to/config.toml backtest
# Live Mode
midas path/to/config.toml live
Application Mode
Alternatively, you can use the system programmatically in your application:
from midas.cli import run
# Backtest Mode
run("path/to/config.toml", "backtest")
# Live Mode
run("path/to/config.toml", "live")
Supported Features
| Data Vendors | |
|---|---|
| ✅ | Databento |
| Brokers | |
|---|---|
| ✅ | Interactive Brokers |
Future Plans
- Add more data sources.
- Integrate additional brokers.
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request with suggestions or improvements.
License
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file midastrader-1.0.24.tar.gz.
File metadata
- Download URL: midastrader-1.0.24.tar.gz
- Upload date:
- Size: 88.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8348179beaab3fb1af5e41e1ac9a24a73c476773112612a06770765c9c5eb468
|
|
| MD5 |
65ec7ea5b05d8ca311708680e72c57fb
|
|
| BLAKE2b-256 |
f3264dc1e64376eb098bbb60044ca71cf5c42405d45cdd3216132faf00290517
|
File details
Details for the file midastrader-1.0.24-py3-none-any.whl.
File metadata
- Download URL: midastrader-1.0.24-py3-none-any.whl
- Upload date:
- Size: 112.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6ac3a1b97df64b367b63cbf273c2dcc61e8c10f0da76b2262c0b9d862b61ac1
|
|
| MD5 |
9712b921553e13b0d59c1b97e7288b9c
|
|
| BLAKE2b-256 |
419b1024e55a3ab2ca6b723dcd85d609b511ba0fbcfba68505a491ef6a4153bd
|