Skip to content

akolishchak/janus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Janus

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.

Features

  • 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.

Requirements

  • Python 3.9+
  • Dependencies: numpy, h5py, plotly, yahoo_fin, requests
    • For plotly image export, install kaleido (e.g. pip install kaleido).

Quick Start

  1. Install dependencies (example):
python -m venv .venv
source .venv/bin/activate
pip install numpy h5py plotly yahoo_fin requests kaleido
  1. Run the example workflow:
python src/main.py

The default settings run on local datasets with daily candles.

Data Layout (offline mode)

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

Live Data

Set live = True in src/main.py or src/janus.py. Live mode uses yahoo_fin.stock_info.get_data and requires network access.

Telegram Output

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.

Project Structure

  • 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).

Disclaimer

This project is for research and educational purposes only and is not financial advice.

License

MIT. See LICENSE.

About

Janus Factor–based relative strength and momentum signals for asset baskets

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors