Skip to content

feat(uta): add INDstocks (INDmoney) broker adapter — Indian equities#394

Open
shaktiman808 wants to merge 1 commit into
TraderAlice:masterfrom
kunalkakade:feat/indstocks-broker
Open

feat(uta): add INDstocks (INDmoney) broker adapter — Indian equities#394
shaktiman808 wants to merge 1 commit into
TraderAlice:masterfrom
kunalkakade:feat/indstocks-broker

Conversation

@shaktiman808

Copy link
Copy Markdown

Summary

Adds an IBroker adapter for INDstocks (INDmoney's trading API), wiring NSE/BSE Indian equities into UTA as a first-class broker engine — OpenAlice's first Indian-market broker.

  • New services/uta/src/domain/trading/brokers/indstocks/IndstocksBroker (full IBroker surface: lifecycle, contract search, place/modify/cancel/close, account/positions/orders, quotes, historical bars, market clock), hand-rolled REST client, contract/symbol mapping, order-update WebSocket stream, types, and a 22-test spec.
  • BrokerEngine extended with 'indstocks'; registry.ts + brokers index.ts wired; presets.ts SerializedBrokerPreset.engine de-duplicated to reuse BrokerEngine.
  • INDSTOCKS_PRESET added to the broker preset catalog (Recommended / securities) with credential fields (stable Client ID + daily Access Token) and hints documenting the SEBI 24h-token reality and the DDPI-for-sells requirement.
  • Preset fingerprints on the stable userId, never the daily accessToken (the token rotates every 24h — fingerprinting it would mint a new UTA id and orphan the commit log on each rotation).

Scope & known limits (intentional — tracked as in-file TODOs)

  • Equities only. F&O (FUT/OPT) deferred — upstream option-chain/greeks are "Coming Soon".
  • LIVE only. INDstocks exposes no paper/sandbox; orders are real money. Test with tiny quantities.
  • Daily token, no refresh. A 403 maps to a permanent BrokerError('AUTH') → halt + surface to the user (paste a fresh token). Never auto-renewed.
  • Selling holdings needs DDPI/eDIS active in the INDmoney account; without it the venue returns a generic InternalServerException with no order_id — the adapter maps this to an actionable error hint rather than a mysterious failure.
  • Field mappings follow the public docs and were spot-checked against live responses, but the broker is labelled SCAFFOLD: it has not been run through the UTA live-testing S1–S12 catalog (that catalog mandates demo accounts, which INDstocks doesn't provide). The successful order_id → cancel round-trip is still unproven (DDPI- and funds-blocked on the test account).

Treat this as a live-only / experimental broker until a full live-venue pass lands.

Test plan

  • npx tsc --noEmit (Alice src/) — clean
  • pnpm -F @traderalice/uta-protocol typecheck — clean
  • pnpm test (whole monorepo) — 2053/2053 passing (139 files), incl. the new 22-test IndstocksBroker.spec.ts and the presets.spec.ts catalog round-trip guard
  • UTA live-testing S1–S12 against a real INDstocks account (deferred — no demo account exists upstream)

Boundary touch

Trading / broker / credentials. New broker engine + credential preset; touches services/uta broker registry and uta-protocol preset catalog. No changes to FX, sealing, snapshots, or guards.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HYGa4ykf6Suq3DZnSxVVKb

Adds an IBroker adapter for INDstocks (INDmoney's trading API), wiring
NSE/BSE equities (secType STK) into UTA as a first-class broker engine.

What landed:
- services/uta/.../brokers/indstocks/ — IndstocksBroker (full IBroker
  surface: lifecycle, contract search, place/modify/cancel/close,
  account/positions/orders, quotes, historical bars, market clock),
  REST client, contract mapping, order-update stream, types, spec
  (22 tests).
- BrokerEngine type extended with 'indstocks'; registry + brokers
  index export wired.
- INDSTOCKS_PRESET added to the broker preset catalog (recommended,
  securities), with credential fields (Client ID + daily Access Token)
  and hints documenting the SEBI 24h-token reality and DDPI-for-sells.
- presets.spec.ts: SAMPLE_CONFIGS fixture for the new preset (the
  catalog round-trip guard requires one per preset).

Scope / known limits (intentional, tracked as in-file TODOs):
- Equities only; F&O (FUT/OPT) deferred.
- LIVE only — INDstocks exposes no paper/sandbox. Orders are real money.
- Daily access token expires every 24h with no refresh; a 403 maps to a
  permanent AUTH error (disable + surface), never auto-renewed.
- Field mappings follow public docs and are not yet verified against
  live venue responses (STATUS: SCAFFOLD) — not yet run through the
  UTA live-testing S1–S12 catalog, which can't use a demo account here.

Boundary: trading / broker / credentials.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYGa4ykf6Suq3DZnSxVVKb
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@shaktiman808 is attempting to deploy a commit to the luokerenx4's Team Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant