Momentum-based ETF rotation. Ranks Indian ETFs by price momentum, generates Zerodha basket orders, and emails them monthly — all automated via GitHub Actions.
- Downloads price data for configured ETFs via yfinance
- Ranks them by momentum (return over a configurable lookback window)
- Picks the top N performers
- Computes BUY/SELL orders by diffing against your current holdings
- Exports orders to Zerodha basket JSON and emails it
Click Fork on GitHub to create your own copy.
In your fork, go to Settings > Secrets and variables > Actions and add:
| Secret | Description |
|---|---|
RESEND_API_KEY |
API key for Resend email service |
TO_EMAIL |
Recipient email address |
Edit config.toml in your fork:
[assets]
equity = ["NIFTYBEES.NS", "GOLDBEES.NS" ]
[meta]
N_TOP = 3
MOMENTUM = 100
SAFE_ASSET = "LIQUIDBEES.NS"
INIT_CASH = 10000(If not starting out fresh)
In your fork, create a new issue using the Submit Holdings template. Enter your holdings as a CSV list:
# TICKER(in yfinance format), Qty, Avg_Price
GOLDBEES.NS, 10, 1000
LIQUIDBEES.NS, 5, 500The parse-holdings workflow will automatically commit 0xdha-holdings.json to your repo.
The Rebalance workflow runs automatically on the 1st of every month (4:00 PM IST). You can also trigger it manually from the Actions tab.
You will receive a JSON file over your email at configured TO_EMAIL.
Whenever you execute the orders on Zerodha, create a new issue using the Submit Holdings template with your updated portfolio. The holdings JSON will be updated automatically and used in the next monthly rebalance.