API-based container and service orchestration for the quantitative trading ecossystem.
The dxforge suite is aimed at small teams and large teams that plan on scaling, reducing costs and maintenance of quantitative trading strategies.
The framework focuses on managing different strategies, their instances, feeds and portfolios via distributed and scalable nodes, without the need of managing them individually.
With a virtual container based approach, the framework is designed to be scalable, fault-tolerant and stress-tested.
If you prefer not to go through the installation process or simply want to run the dxforge
without having
Python and the dependencies set up, you can use the precompiled executables. This is especially useful for deployment or
sharing with users who might not be familiar with Python environments.
pip install -r requirements.txt
python dxforge start
Produces:
Starting dxforge...
Started with PID 231835
- Navigate to the Releases section.
- Download the appropriate file for your operating system:
dxforge.sh
for Linux/macOSdxforge.exe
for Windows
- After downloading, follow the instructions below.
- First, you'll need to extract the compressed file. If you've downloaded the `strategy_manager_linux.tar.gz` from the releases, you can decompress it using the following command:
tar -xzvf strategy_manager_linux.tar.gz
This will extract the contents, including strategy_manager.sh (the shell script) and the actual compiled binary strategy_manager.
To run the dxforge using the shell script:
-
Access the directory containing the sample strategy and feed managers
cd dxforge
-
Run the script:
./dist/dxforge [config_file] [--host] [--port] # e.g. ./dist/dxforge config.yaml
Replace [arguments]
with any command-line arguments you wish to pass to the dxforge.
A standalone executable named strategy-manager.exe
is available for Windows users.
To run the dxforge using the executable:
-
Navigate to the directory containing the project files using the Command Prompt or PowerShell.
cd strategy-manager
-
Run the executable:
.\dist\strategy-manager.exe [config_file] [--host] [--port] # e.g. .\dist\strategy-manager.exe config.yaml
Replace [arguments]
with any command-line arguments you wish to pass to the dxforge.
Note: The first time you run these executables, your operating system might prompt you to verify if you trust
software from the publisher. Ensure you trust the source (in this case, the strategy_manager
project) before
proceeding.
- Python 3.7+
virtualenv
or any other virtual environment manager
-
Clone the repository:
git clone [email protected]:divergex/dxforge.git
-
Navigate to the repository directory and create a virtual environment:
virtualenv venv
-
Activate the virtual environment:
- For Linux/macOS:
source venv/bin/activate
- For Windows:
venv\Scripts\activate
- For Linux/macOS:
-
Install required packages:
pip install -r requirements.txt
To start the dxforge instance locally, run:
python dxforge config.yaml
Optional command-line arguments:
--host
to specify the host (default is0.0.0.0
)--port
to specify the port (default is8000
)
-
Listing Strategies:
Visithttp://localhost:8000/strategy/
to get a list of all available strategies. -
Refreshing Strategy Status:
POST request tohttp://localhost:8000/strategy/
to refresh the status of all strategies. -
Proxy Get Routes for a Strategy:
GET request tohttp://localhost:8000/strategy/{strategy}/
to get routes available for a strategy. -
Proxy Get and Post Methods for a Strategy Endpoint:
- GET:
http://localhost:8000/strategy/{strategy}/{endpoint}
- POST:
http://localhost:8000/strategy/{strategy}/{endpoint}
with appropriate data payload.
- GET:
A sample strategy folder (strategies/rsi-strategy
) is provided to demonstrate how to use the dxlib
library.
This script uses historical stock data for a set of tickers, runs a simple RSI strategy on the data, and calculates a
list of signals.
To run the sample dxforge instance:
python strategies/rsi-strategy/run.py
And in another terminal, run the dxforge:
python __main__.py config.yaml
# or
# ./dist/dxforge config.yaml
Managers can be added or removed by modifying the a yaml file.
Example: config.yaml
{
"feeds": "feeds/docker-compose.yaml",
"strategies": "strategies/docker-compose.yaml",
"port": "5000",
"host": "0.0.0.0"
}
In this configuration, strategies
has a list of docker compose services that serve on different ports. These available
ports can be accessed at http://localhost:5000
.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.