A lightweight local trading research environment — think simplified open-source TradingView.
Streamlit UI, Plotly candlestick charts, Backtrader behind an adapter, SQLite cache for OHLCV. Designed to be understandable, hackable, and AI-coding friendly.
- Pick a ticker (any symbol yfinance / Alpha Vantage supports — stocks, ETFs, indices, crypto).
- Download historical OHLCV bars, cached locally in SQLite.
- Toggle technical indicators (SMA, EMA, RSI, MACD, Bollinger, Momentum, Stochastic, ATR) — overlays on the price pane, oscillators in their own sub-panels.
- Run rule-based strategies (SMA Cross, RSI Reversion, MACD Cross) via Backtrader.
- See entry / exit triangles directly on the candles, plus return / Sharpe / drawdown / win-rate metrics and a full trade log.
conda create -n equity-research python=3.11 -y
conda activate equity-research
conda install -c conda-forge ta-lib -y
pip install streamlit plotly backtrader yfinance scikit-learn pandas numpy requestsThen either:
- Double-click
start.bat(Windows) — handles env activation and launches the app on http://localhost:8520 - Or manually:
streamlit run app.py
Small files, single-purpose, no deep abstractions.
| File | Role |
|---|---|
app.py |
Streamlit entrypoint |
ui.py |
Sidebar + main panel layout |
chart.py |
Plotly candlestick figure builder |
data_loader.py |
Provider adapters (yfinance, Alpha Vantage) with caching |
indicators.py |
TA-Lib-backed indicator math |
strategy.py |
Backtrader strategy classes (rule-based) |
backtest.py |
Backtrader adapter — only file that imports backtrader |
database.py |
SQLite OHLCV cache |
config.py |
Config load/save |
config.json |
All defaults (tickers, periods, cash, commission, …) |
smoke_test.py |
Backend smoke check (no UI) |
Backtrader sits behind backtest.run() returning a plain BacktestResult, so the engine can be swapped without touching anything else.
Edit config.json. Indicator periods, strategy thresholds, default ticker/date range, backtest cash and commission all live there.
For Alpha Vantage, set the environment variable named in data.alpha_vantage_api_key_env (default ALPHAVANTAGE_API_KEY).
See PROJECT.md for the full project philosophy, MVP milestones, and explicit non-goals.
The TL;DR:
- Goal: simplified, visual, hackable TradingView clone for local research.
- Not a goal: live trading, broker integration, microservices, anything you'd build for an HFT shop.
First MVP milestone (visual candles + SMA cross backtest with markers on chart) is reachable from the UI.
Roadmap from PROJECT.md: parameter search, multi-symbol batches, vectorbt for sweeps, eventual ML extensions.
