Algo Trading Stack

A fast, config-driven trading simulator & backtesting sandbox with futures mechanics, ATR risk controls, and GUI/CLI.

Skip to content
⚠️ Not financial advice. For educational use only.
Home

Algo Trading Stack

⚠️
Disclaimer — actively testing, not a finished product

This project is under ongoing development and testing. Much of it was built with help from AI, so it is most likely riddled with bugs.

We’re publishing it because it may be useful, but it’s not “production‑ready.” Use at your own discretion.

A developer‑focused sandbox for systematic trading.
Algo Trading Stack is a framework for building and testing algorithmic trading strategies. It was designed around futures contracts and TradeStation’s APIs, but the architecture is open and extensible so it can adapt to other brokers and markets.

The platform grew out of a need for more flexibility and control than typical broker tools provide. It offers a backtesting engine with realistic execution modeling (slippage, commissions, margin, leverage), risk‑aware defaults (ATR sizing, trailing stops, equity enforcement), and modular components that can be swapped or extended.

One of the first strategies implemented was a replication of Tom Basso’s coin‑flip experiment — exploring how risk management and position sizing affect random entries. From there, the framework expanded into a general sandbox for developing, refining, and evaluating systematic strategies in a data‑driven way.


Key Features

  • 🛠 Developer‑Centric — Pure Python, clean APIs, and modular classes (no proprietary languages or walled gardens).
  • 🔄 Extensible by Design — Plug in your own bots, exit strategies, risk models, and data feeds.
  • 🎯 Risk‑Aware Defaults — ATR‑based position sizing, trailing exits, leverage handling, maintenance‑margin enforcement.
  • 📊 Transparent Results — Equity curves, trade logs, PnL breakdowns, and reproducible runs.
  • 🖥️ CLI + GUI — Headless for speed or a PyQt GUI for visual inspection of candles, stops, and equity curves.

Why This Exists

  • Discipline and consistency are hard to maintain by hand — bots execute rules the same way every time.
  • Futures demand realism — leverage, margin, tick size/value, and fees can dominate outcomes; the engine models these explicitly.
  • Flexibility matters — use TradeStation today, but keep the door open to other brokers by implementing an API class.
  • Research, not hype — this is a sandbox for testing ideas with data and transparent mechanics.

What It Is

A config‑driven backtesting engine and strategy development stack:

  • Designed for automated trading bots and systematic exits.
  • Realistic execution modeling: slippage, commissions, margin, leverage, tick sizes.
  • Extensible architecture: swap or extend bots, exits, risk modules, and broker adapters.
  • Ships with risk tooling and example strategies (e.g., Coin Flip, Trend‑Following).
  • Runs headless for iteration speed or via GUI for visual debugging and exploration.

Capabilities at a Glance

Backtesting First
Bots • exits • statistics
Realistic Execution
Slippage • commissions • margin
Extensible
Python APIs • modular design
  • Execution realism — first‑touch stops, slippage modeling, commissions/fees.
  • Config‑driven — YAML for symbols, risk, and broker settings.
  • Risk & accounting — ATR sizing, trailing exits, leverage & margin, equity/margin enforcement.
  • Pluggable components — bring your own strategies, exits (ATR, bandit/RL overlays), and adapters.
  • Testing — regression and risk checks to keep results reproducible.

Get Started

Clone the repo and run your first backtest, then explore the sample strategies.


Quickstart

git clone https://github.com/denkovarik/Algo-Trading-Stack-Public.git
cd algo-trading-stack
python3 -m venv venv && source venv/bin/activate
./setup/install.sh
./setup/fetch_sample_portfolio_futures_data.sh
 
# run with GUI
PYTHONPATH=. python3 run_backtest.py
 
# run a backtest (headless)
PYTHONPATH=. python3 run_backtest_headless.py