AlgoTrader is an experimental trading project that uses the Lightweight Charts library to visualize historical market data.
The project is structured into multiple services, each responsible for a specific aspect of the trading system:

This project is in active development and may undergo significant changes. Backward compatibility is not guaranteed—things might break! Please use this repository for reference only and not as a stable library.
Trading in derivative instruments—including futures, options, CFDs, Forex, and certificates—carries significant risk and may not be appropriate for all investors. There is a possibility of losing the entire initial investment or even more. Use this project at your own risk.
If AlgoTrader has helped you with your algorithmic trading journey, you can support its continued development by using my IC Trading affiliate link when opening a trading account. IC Trading offers competitive spreads and reliable execution for algorithmic traders.
Using this link costs you nothing extra but helps fund the development of new features and improvements.
- Docker installed on your machine.
- Clone the repository:
git clone https://github.com/s-stolz/algotrader.git cd algotrader - Create local secrets from the example:
cp config/.env.secrets.example config/.env.secrets.local
- Generate the root
.envfrom the tracked topology + local secrets:python scripts/generate_env.py
- Edit
config/topology.yamlfor shared non-secret settings (ports, hosts, tuning), and editconfig/.env.secrets.localfor credentials/secrets. - Run the project and explore.
Default workflow (auto-regenerates .env before Compose):
make upDirect Docker Compose usage:
python scripts/generate_env.py --force
docker compose up --buildThis will build and start all necessary services as defined in the docker-compose.yml file.
- Tracked shared topology:
config/topology.yaml - Gitignored secrets:
config/.env.secrets.local - Generated runtime env files:
config/.env.shared,config/.env.secrets.db,config/.env.secrets.runtime,config/.env.secrets.broker - Generator script:
scripts/generate_env.py
python scripts/generate_env.py --validate
python scripts/generate_env.py --forcemake config
make validate-config
make up
make build
make down
make restart
make logs
make psUse a root virtual environment for shared library/test tooling and per-service virtual environments for service runtime dependencies.
- Shared versions live in
constraints-shared.txt. - Each service keeps its own
requirements.txt. - If a service must diverge, add
<service>/constraints.override.txtwith a short rationale comment.
make venvsEquivalent direct command:
./scripts/setup_venvs.sh allThis now creates:
- root environment:
.venvusingrequirements.root.txt - service environments:
<service>/.venvusing each servicerequirements.txt
make venv-rootmake venv SERVICE=broker-servicemake venvs-recreatemake venvs-check- Open
algotrader.code-workspacein VS Code (not only the repo root folder). - The workspace uses
python.defaultInterpreterPath = ${workspaceFolder}/.venv/bin/python, so each service folder resolves to its own.venv. - If a service interpreter is not picked up immediately, run
Python: Select Interpreteronce while a file from that service is active.
This project is licensed under the MIT License - see the LICENSE file for details.
This project makes use of third-party software so please check the ATTRIBUTIONS.md file for more information.