Feat: Adding support for equity markets in india#305
Open
muku314115 wants to merge 1 commit into
Open
Conversation
Collaborator
|
Thanks for the PR — we’ve seen it and will review as soon as we can. For market-support changes, the main things we’ll check are symbol conventions, loader/data-source behavior, deterministic tests, and whether the first version stays narrowly scoped enough to maintain. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
equity_infactor universe → live/paper broker + mandate wiring.IndiaEquityEnginemodeling T+1 delivery, no overnight shorts (allow_shortopt-in), configurable circuit bands, 1-share lots, and the STT / stamp-duty / exchange / SEBI / GST cost stack..NS/.BOsymbols to Yahoo (native NSE/BSE coverage), with yfinance and an opt-in Shoonya/Dhan broker data bridge as fallbacks.Why
Indian symbols previously had zero research support: they silently misrouted to China infrastructure (
tushareloader +ChinaAEngine), producing wrong fills and costs. India was the only market withlive broker connectors (Shoonya/Dhan) but no data/backtest/factor path. This wires the broken middle so the existing strategies, factors, and metrics work on NSE/BSE.
Changes
.NS/.BOrouting inmarket_data.py+_market_hooks.py(newindia_equitymarket type); extendedyahoo_loader/yahoo_clientandyfinance_loaderto accept the suffixes;india_equityfallback chain inregistry.py;runner.pysource map. Regexes allow&/-(e.g.M&M.NS,BAJAJ-AUTO.NS).backtest/engines/india_equity.py; wired intocomposite.pyandrunner.pysingle-market routing (precedes source-based routing so India'syahoosource can't fall through to thecrypto default).
equity_into theUniverseliteral andMarketenum (vwap uses the typical-price branch — India bars carry raw price/volume, no Tushare scaling); tagged all 101 Alpha101 and 154QLib158 factors for
equity_in. GTJA191 left China-only (Tushare-scale math).AssetClass.IN_EQUITYand wired it into the mandate-enforcement loader chain; newbacktest/loaders/india_broker_loader.pybridges Shoonya/Dhanget_historical_barsinto thebacktest layer (opt-in
india_brokersource, unavailable without broker creds). Live order placement stays structurally disabled (those brokers expose no paper/live switch).SKILL.mdupdated (8 engines, 19 sources, India symbol convention, factor coverage, paper/read-only-live limitation).Test Plan
pytest --ignore=agent/tests/e2e_backtest --tb=short -q)test_india_equity_engine.py,test_india_backtest_smoke.py,test_india_mandate.py,test_india_broker_loader.py,tests/factors/test_india_universe.py, plus India cases intest_market_data.py,test_market_detection.py,test_yahoo_loader.py,test_registry.pyequity_in; representative Alpha101/QLib158 factors compute on a synthetic NSE panel; end-to-end India backtest emits metricstools/ci_grep_gates.shall gates pass;ruff checkclean across the contributionfootprint
Checklist
src/agent/,src/session/,src/providers/) without prior discussionruff check(the configured gate) passes on all new/changed files; public signatures type-annotated; Google-style docstringsSKILL.mdReviewer notes
pytest --ignore=agent/tests/e2e_backtestrun (the sandbox lacks some optional deps, e.g.fastmcp). Please let CI confirm the full suite.knobs.
india_brokerbridge returns a bounded window of recent bars (broker API limit) — use Yahoo for deep history.blackwas not run: the repo is not black-conformant (untouched core files failblack -l120), so formatting only these files would diverge from house style. Files conform to the configuredruffgateinstead.