Open source · MIT licensed

Algorithmic trading, simplified

Rule-based strategies, 14-check risk management, and a real-time dashboard. Backtest on historical data, then deploy to Alpaca with one config change.

terminal

$ pip install klawtrade

$ klawtrade init --quick

$ klawtrade start

KlawTrade running | Dashboard: http://localhost:8080

Strategies: momentum, mean_reversion | Watchlist: 10 symbols

Features

Everything you need to trade algorithmically

From strategy execution to risk management to backtesting — all in a single pip-installable package.

Rule-Based Strategies

Momentum and mean reversion strategies using SMA crossover, RSI, MACD, Bollinger Bands, and Stochastic RSI. No black-box ML.

14-Check Risk Gate

Every signal passes through position sizing, loss limits, drawdown protection, sector allocation, and correlation checks. No overrides.

7-Trigger Circuit Breaker

Automatic trading halt on consecutive losses, daily/weekly loss limits, max drawdown, VIX spikes, or system errors.

Historical Backtesting

Download market data, replay through strategies and risk management, get Sharpe ratio, win rate, drawdown, and full trade logs.

Real-Time Dashboard

Live equity curve, positions, trade log, and kill switch via WebSocket. See everything happening in real time at localhost:8080.

Alpaca Integration

Add your API keys to trade with real money via Alpaca. Works in simulation mode without any keys — no signup required.

Backtesting

Test before you trade

Run your strategies against historical market data to evaluate performance before risking real capital.

backtest

$ klawtrade backtest \

--start-date 2024-01-01 \

--end-date 2024-12-31 \

--symbols AAPL,MSFT,NVDA \

--strategy momentum

Downloading historical data...

Computing technical indicators...

Replaying 252 bars across 3 symbols...

Sample Report
Total Return+18.42%
Sharpe Ratio1.847
Max Drawdown-6.31%
Win Rate62.5%
Profit Factor2.134
Total Trades48
Avg Hold4.2 days
Exposure71.4%
Signals48 approved/23 rejected

Sample output is illustrative. Actual results depend on market conditions and configuration.

Up and running in 3 steps

1

Install

pip install klawtrade
2

Configure

klawtrade init
3

Trade

klawtrade start

Built in the open. MIT licensed.

KlawTrade is fully open source. Inspect every line of code that touches your money. Contribute strategies, fix bugs, or fork it and make it your own. No black boxes, no vendor lock-in.

View on GitHub