Algorithmic trading for Indian markets (NSE, BSE) on top of the ml4t-* ecosystem
Project description
ml4t-india
Algorithmic trading for Indian markets (NSE, BSE) on top of the ML4T library ecosystem.
Status: pre-alpha. Phase-1 Zerodha Kite integration complete. Publishing pipeline ready.
What this is
ml4t-india is a thin extension layer that adapts the five ML4T companion
libraries to Indian equity and derivatives markets via the
Zerodha Kite Connect v3 broker API.
It contributes only what is India-specific. Every generic capability (engine, indicators, diagnostics, risk framework, storage) is delegated to the upstream libraries unchanged:
| Upstream library | Role | India-specific work |
|---|---|---|
ml4t-data |
DataManager, BaseProvider, storage |
KiteProvider, bhavcopy providers |
ml4t-engineer |
120 indicators, labeling, alt bars | None — consumed as-is |
ml4t-backtest |
Event-driven engine, Strategy, presets |
IndianChargesModel, nse_india preset |
ml4t-live |
LiveEngine, SafeBroker, protocols |
KiteBroker, KiteTickerFeed |
ml4t-diagnostic |
DSR, CPCV, tear sheets | Calendar wiring only |
Design principles
- Extend, don't re-implement. Every adapter subclasses the upstream
concrete base where one exists (e.g.
IndianOHLCVProvider(BaseProvider)). Where upstream only exposes atyping.Protocol, we implement it once in an India-level abstract base (IndianBrokerBase,IndianTickerFeedBase) and every concrete broker extends that — so the protocol is adhered to exactly once. - Drift-insulated. The weekly
upstream-driftCI job installs the latestml4t-*from PyPI and re-runs the full suite. Signature-level drift is caught by dedicated snapshot tests. - Pure Python. No C extensions of our own, so a single universal wheel
serves both GIL and free-threaded CPython. See
docs/free-threaded.md. - TDD at every adapter boundary. Contract tests verify substitutability for upstream protocols; recorded HTTP cassettes drive integration.
Phase-1 scope (Zerodha, full surface)
- Historical candles (1m, 3m, 5m, 10m, 15m, 30m, 60m, day), OI, continuous F&O.
KiteTickerWebSocket (ltp / quote / full modes, 3000 instruments / connection, 3 connections).- Orders: regular / AMO / CO / iceberg / auction.
- Product types: CNC / MIS / NRML / MTF.
- Option chain with Greeks (Black-Scholes) and analytics (PCR, max-pain, ATM ladder).
- Zerodha fee schedule: brokerage + STT + exchange turnover + GST + SEBI + stamp.
- Bhavcopy bulk providers: NSE / BSE / MCX for long-history backfill.
Installation
pip install ml4t-india # core
pip install ml4t-india[options] # + Black-Scholes Greeks
pip install ml4t-india[viz] # + plotly tear sheets
pip install ml4t-india[all]
Documentation
- Quickstart — login, historical data, backtesting, option chain, live trading, NSE calendar
- Integration Testing — real broker smoke tests with OS keychain credential storage (no secrets in git)
- Releasing — tag-triggered PyPI publish via OIDC + conda-forge recipe workflow
Full documentation will be published to https://shankarpandala.github.io/ml4t-india/ once Phase-1 stabilises.
Integration Testing
Real broker tests run locally against a live Zerodha Kite account. Credentials
are stored in the OS keychain — never in .env files, config files, or git.
# Store credentials once (Windows Credential Manager / GNOME Keyring / macOS Keychain)
python scripts/store_kite_credentials.py
# Daily refresh (Kite tokens expire at ~06:00 IST)
python scripts/store_kite_credentials.py --refresh
# Run the 6-test smoke suite
pytest tests/integration -m integration -v
Tests skip cleanly when credentials are absent. They never run on GitHub Actions. See docs/integration-testing.md for VPS/Linux setup, troubleshooting, and security properties.
License
Not licensed yet.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ml4t_india-0.1.0.tar.gz.
File metadata
- Download URL: ml4t_india-0.1.0.tar.gz
- Upload date:
- Size: 108.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a37f34024f32e2743e9f100c2fa3d04c92d1118a4a315954d07eeba605e22ba3
|
|
| MD5 |
af50e575b1d6dc650eb6a5dfde955ddc
|
|
| BLAKE2b-256 |
c1bd0abe50d4e586d47cb62083cd7cd8615365040b80f2e5f89fb6f081c49a23
|
Provenance
The following attestation bundles were made for ml4t_india-0.1.0.tar.gz:
Publisher:
publish.yml on shankarpandala/ml4t-india
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ml4t_india-0.1.0.tar.gz -
Subject digest:
a37f34024f32e2743e9f100c2fa3d04c92d1118a4a315954d07eeba605e22ba3 - Sigstore transparency entry: 1402919967
- Sigstore integration time:
-
Permalink:
shankarpandala/ml4t-india@86d4bfef113b602ab137babc9393b4bcb63656b2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/shankarpandala
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@86d4bfef113b602ab137babc9393b4bcb63656b2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ml4t_india-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ml4t_india-0.1.0-py3-none-any.whl
- Upload date:
- Size: 84.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ed6ac9c4ff0ad44426b4979e1b2d586a9e4350dd70b0d4bf1005e81c239f22
|
|
| MD5 |
b64c8103278f8e3bd841eacd0aeaefed
|
|
| BLAKE2b-256 |
6b82c4dd5b4675772b5d9003046bf7967ffd23c8c374497905482f29f281bbce
|
Provenance
The following attestation bundles were made for ml4t_india-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on shankarpandala/ml4t-india
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ml4t_india-0.1.0-py3-none-any.whl -
Subject digest:
02ed6ac9c4ff0ad44426b4979e1b2d586a9e4350dd70b0d4bf1005e81c239f22 - Sigstore transparency entry: 1402920088
- Sigstore integration time:
-
Permalink:
shankarpandala/ml4t-india@86d4bfef113b602ab137babc9393b4bcb63656b2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/shankarpandala
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@86d4bfef113b602ab137babc9393b4bcb63656b2 -
Trigger Event:
push
-
Statement type: