Market-relative strength and momentum analysis for a basket of assets, with leader/laggard ranking and a simple rules-based signal. Janus can run on local HDF5 datasets or live Yahoo Finance data, and it can post summaries and charts to Telegram.
This trading strategy implementation is based on the Janus Factor by Gary Edwin Anderson.
- Relative strength (RS), relative momentum (RM), dominance (DOM), and spread metrics across a universe.
- Leader/laggard ranking and buy/sell list generation.
- Plotly charts exported to PNG and sent via Telegram.
- Offline (HDF5) or live (Yahoo Finance) data sources.
- Python 3.9+
- Dependencies:
numpy,h5py,plotly,yahoo_fin,requests- For
plotlyimage export, installkaleido(e.g.pip install kaleido).
- For
- Install dependencies (example):
python -m venv .venv
source .venv/bin/activate
pip install numpy h5py plotly yahoo_fin requests kaleido- Run the example workflow:
python src/main.pyThe default settings run on local datasets with daily candles.
Janus expects HDF5 files under:
dataset/<quote>/<interval>/*_<interval>.h5
Each file should include a candles dataset. Only the close column is
required (index 3); other OHLCV fields can be present.
Example:
dataset/stocks2/1d/AAPL_1d.h5
Set live = True in src/main.py or src/janus.py. Live mode uses
yahoo_fin.stock_info.get_data and requires network access.
src/main.py posts a message and two PNG charts via src/messenger.py.
Set TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID in your environment to match
your Telegram setup, or remove the Messenger calls if you do not want
posting.
src/janus.py: Core analytics and signal generation.src/main.py: Example runner (alerts + charts).src/candles.py: Live candle retrieval.src/asset.py: Asset universe (S&P 500 list by default).src/messenger.py: Telegram posting helpers.dataset/: Local HDF5 candles (optional).
This project is for research and educational purposes only and is not financial advice.
MIT. See LICENSE.