Skip to content

fix(instruments): deduplicate AngelOne rows, populate derivative names#60

Merged
Apurv-Salunke merged 1 commit into
mainfrom
fix/instrument-name-convention
Mar 27, 2026
Merged

fix(instruments): deduplicate AngelOne rows, populate derivative names#60
Apurv-Salunke merged 1 commit into
mainfrom
fix/instrument-name-convention

Conversation

@Apurv-Salunke

@Apurv-Salunke Apurv-Salunke commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • AngelOne duplicate instruments — symbols appearing as both index (AMXIDX) and plain equity in AngelOne's master (e.g. NIFTY, BANKNIFTY) are now deduplicated; the index row is kept, the spurious equity row is skipped.
  • Empty display names for derivatives — futures and options name column was always NULL. Now populated with human-readable labels: NIFTY FUT 27-Mar-2026 (futures), NIFTY 23000 CE 27-Mar-2026 (options). Applies to both brokers.

Test plan

  • make ci passes (lint, typecheck, 349 tests, 81.78% coverage)
  • Verify AngelOne DB has no duplicate NIFTY rows after refresh
  • Verify futures/options name column is populated after refresh

🤖 Generated with Claude Code

Summary by CodeRabbit

Bug Fixes

  • AngelOne instrument ingestion now properly deduplicates overlapping symbols that appear as both index and equity rows, keeping only the index row and removing spurious duplicates.
  • Futures and options derivatives now display human-readable names instead of remaining blank, with formatted expiry dates and strike information where applicable across all supported brokers.

… derivative display names

AngelOne's master lists symbols like NIFTY as both an AMXIDX index and a plain
NSE equity — the parser now tracks index symbols and skips the spurious equity
duplicate. Futures/options name column was always NULL; now generates
human-readable labels (e.g. "NIFTY FUT 27-Mar-2026", "NIFTY 23000 CE 27-Mar-2026").

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Apurv-Salunke Apurv-Salunke added the semver:patch Backward-compatible fix/chore (patch bump) label Mar 27, 2026
@Apurv-Salunke Apurv-Salunke self-assigned this Mar 27, 2026
@Apurv-Salunke Apurv-Salunke merged commit a5c1bc7 into main Mar 27, 2026
7 checks passed
@Apurv-Salunke Apurv-Salunke deleted the fix/instrument-name-convention branch March 27, 2026 06:56
@coderabbitai

coderabbitai Bot commented Mar 27, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1ee60df0-f8e4-4373-8b2a-4212a2454200

📥 Commits

Reviewing files that changed from the base of the PR and between 16ea046 and bb2bad5.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • tt_connect/brokers/angelone/parser.py
  • tt_connect/core/store/manager.py

📝 Walkthrough

Walkthrough

The changes add deduplication logic to the AngelOne instrument parser to prevent symbols appearing as both indices and equities, and populate human-readable display names for derivative instruments (futures and options) that previously returned NULL values.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Added two entries documenting fixes: AngelOne symbol deduplication and population of display names for derivatives.
AngelOne Parser
tt_connect/brokers/angelone/parser.py
Introduced index_symbols set to track parsed index symbols. Updated equity parsing to strip "-EQ" suffix and skip appending equities that duplicate already-ingested indices (e.g., preventing NIFTY from appearing as both index and equity).
Store Manager
tt_connect/core/store/manager.py
Added three internal formatting helpers (_fmt_expiry, _future_display_name, _option_display_name) to generate human-readable names for futures and options based on expiry date and strike. Updated _insert_futures and _insert_options to populate the name column instead of leaving it NULL.

Poem

A rabbit hops through data streams so bright,
Deduping symbols left and left (not right!),
Derivatives now shine with names that gleam,
No more NULL values haunting the scheme,
Our instruments sing—what a coding dream! 🐰✨

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/instrument-name-convention

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

semver:patch Backward-compatible fix/chore (patch bump)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant