--- title: "Python Tools for Solo Systematic Trading" date: 2026-05-21 source: agent research --- # Python Tools for Solo Systematic Trading Scripts, utilities, and libraries for day-to-day systematic trading on Python 3.12+ with VectorBT + NautilusTrader as core stack. ## 1. Market Data Warehousing | Tool | Stars | What It Does | Fit | |---|---|---|---| | [yfinance](https://github.com/ranaroussi/yfinance) | 15k | Download OHLCV bars from Yahoo Finance. Free, no API key. Rate-limited 2k req/day. | Prototyping. Not for production backtests (survivorship-biased). | | [pandas-datareader](https://github.com/pydata/pandas-datareader) | 2.7k | Unified interface to Yahoo, Federal Reserve, NASDAQ, Quandl, Alpha Vantage, Eurostat. | Macro/economic data alongside market data. | | [alpha_vantage](https://github.com/RomelTorres/alpha_vantage) | 4.2k | Wrapper around Alpha Vantage API. OHLCV, intraday (1-min), FX, crypto, options. | Backup when yfinance rate-limits. Supports 1-min bars. | | DuckDB + Parquet | N/A | Store in Parquet (columnar, compressed), query with DuckDB (embedded, no server). Scan terabytes in seconds. | Zero-ops warehouse. Pairs with yfinance -> Parquet -> DuckDB. | | TimescaleDB | N/A | Postgres extension. Continuous aggregates auto-materialize OHLC candles from ticks. | Live tick data on STARGATE. Multi-threaded, crash-safe. | **Reference**: [Personal Market Database with DuckDB and Parquet](https://medium.com/data-science-collective/how-i-built-a-personal-market-database-with-duckdb-and-parquet-step-by-step-27b0d1bb7e2e) ## 2. Portfolio Analytics and Tearsheets | Tool | Stars | What It Does | Fit | |---|---|---|---| | [quantstats](https://github.com/ranaroussi/quantstats) | 5.2k | 50+ metrics: Sharpe, Sortino, Calmar, max drawdown, VaR, CVaR, ulcer index. Interactive HTML tearsheets. | Industry standard. Run daily on live equity curve. | | [pyfolio](https://github.com/quantopian/pyfolio) | 5.5k | Tear sheets, return analysis, risk metrics, factor attribution. Originally from Quantopian. | Good for factor analysis; more academic than quantstats. | | [PyPortfolioOpt](https://github.com/rong002/PyPortfolioOpt) | 7k | Modern portfolio theory, efficient frontier, Kelly optimization, risk budgeting. | Use `.kelly_objective()` for position sizing. | ## 3. Order Execution / Broker Wrappers | Tool | Stars | What It Does | Fit | |---|---|---|---| | [ib_async](https://github.com/ib-api-reloaded/ib_async) | 1.5k | Async/await wrapper around IBKR TWS/Gateway. Full API: orders, positions, market data, account balance. | Production-ready. Handles partial fills, rejections. Successor to ib_insync. | | [alpaca-py](https://github.com/alpacahq/alpaca-py) | 2.8k | Official Alpaca SDK. Market data (5000+ stocks, 20+ crypto), paper/live trading, options, positions. | Paper trading is free. Asset-specific clients. | | [coinbase-advanced-py](https://github.com/coinbase/coinbase-advanced-py) | 500+ | Official Coinbase Advanced API wrapper. Order execution, market data, portfolio management. | Maintained by Coinbase. | | public.com | N/A | No major Python wrapper found. Implement via REST API directly (`httpx`). | Roll your own. | ## 4. Risk Management and Position Sizing **Kelly Criterion**: Use PyPortfolioOpt's `.kelly_objective()` or manual: ```python kelly_pct = (win_rate * reward_ratio - loss_rate) / reward_ratio # Use 10-25% of full Kelly in practice ``` **Position sizing methods**: - Fixed size (same contracts/shares per trade) - Percent allocation (% of capital) - Fixed fractional risk (% of capital per trade x risk ratio) - Volatility-targeted (Rob Carver's approach via `cvxpy`) **Correlation monitoring**: [franklinjtan/Portfolio-Diversification-Correlation-Risk-Management](https://github.com/franklinjtan/Portfolio-Diversification-Correlation-Risk-Management-with-Python) -- correlation matrices, heatmaps, beta calculations. Run weekly for pairs/stat arb. ## 5. Alerts and Notifications | Tool | Stars | What It Does | |---|---|---| | [TradingView Webhook Bot](https://github.com/fabston/TradingView-Webhook-Bot) | 2.5k | Listen to TradingView alerts via Flask webhooks; forward to Telegram, Discord, Slack, email. Self-hosted. | | `python-telegram-bot` + `schedule` | N/A | Monitor price thresholds, drawdown levels, position breach alerts via API polling -> Telegram. | ## 6. Technical Analysis Indicators | Tool | Stars | What It Does | |---|---|---| | [pandas-ta](https://github.com/0xAVX/pandas-ta) | 5.5k | 150+ indicators as pandas DataFrame extensions. `df.ta.rsi()`, `df.ta.macd()`. Vectorized, fast. | | [alphalens](https://github.com/quantopian/alphalens) | 3k | Forward-looking factor analysis. Decay curves, holding period analysis, correlation with returns. | | TA-Lib (C backend) | N/A | 34 core indicators, faster than pandas-ta for large backtests. Overkill for most use cases. | ## 7. Jupyter Notebook Templates | Source | What It Provides | |---|---| | [QuantConnect/Research](https://github.com/QuantConnect/Research) | 30+ templates: pairs trading with cointegration, Kalman filtering, fundamental factor analysis, Alphalens integration. | | [walk-forward-backtester](https://github.com/TonyMa1/walk-forward-backtester) | Rolling window optimization with Bayesian optimization. Essential for overfitting prevention. | ## 8. Mercury Bank API | Tool | What It Does | |---|---| | [mercury-bank-api](https://pypi.org/project/mercury-bank-api/) (PyPI) | Python client for Mercury API. Account queries, ACH transfers, transaction history. | | [Mercury API docs](https://docs.mercury.com/docs/welcome) | Direct REST with Bearer token. Script with `httpx`. | | [mcp-mercury-banking](https://github.com/jbdamask/mcp-mercury-banking) | MCP server for Mercury (LLM-friendly read-only queries). | **Cash flow pattern**: Mercury Treasury (4-5% APY on idle cash) -> programmatic ACH to broker when buying power needed -> ACH back when flat. ## 9. Backtesting Frameworks (Quick Reference) | Tool | Stars | Best For | |---|---|---| | [VectorBT](https://github.com/polakowo/vectorbt) | 4.5k | Fastest for parameter sweeps. Numba-accelerated. | | [backtesting.py](https://github.com/kernc/backtesting.py) | 5.2k | Clean Pythonic API, easy learning curve. | | [Zipline-Reloaded](https://github.com/stefan-jansen/zipline-reloaded) | 2.8k | Best for equity factor research. | | [NautilusTrader](https://github.com/nautechsystems/nautilus_trader) | 1.8k | Production-grade Rust core. Research -> live bridge. | ## Stack Summary ``` Data flow: yfinance -> DuckDB/Parquet -> VectorBT backtest Research: Jupyter + QuantConnect templates (pairs, factor analysis) Live: NautilusTrader executes; ib_async (IBKR) or alpaca-py (paper) for orders Monitoring: quantstats daily tearsheets + drawdown alerts (Telegram) Cash flow: mercury-bank-api automates yield sweeps Reconciliation: Compare NautilusTrader fills vs. broker API fills via SQLite OMS Indicators: pandas-ta (150+ indicators as DataFrame extensions) ```