feat: add CDSL Consolidated Account Statement support#122
Merged
codereverser merged 1 commit intoMay 10, 2026
Merged
Conversation
- Add cdsl_statement.py with full CDSL CAS parser - Parse demat holdings (equities, mutual funds in demat, bonds) - Parse mutual fund folio holdings - Handle multi-line security names and page breaks - Route FileType.CDSL to the new parser in process/__init__.py - Fix nsdl_statement.py parse_header to search full text not just [:1000] - Fix formatINR in cli.py (decimal places, Indian grouping) - Add asset class breakdown summary in print_nsdl output - Improve table column sizing to prevent overflow truncation
Owner
|
Many thanks for the PR. It was a long-standing feature request. I noticed that it breaks for one CDSL CAS statement I have (works on others), but the issue is with the parser, not the code here. I'll try to fix it in a separate PR. |
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
casparseronly supported NSDL demat CAS statements; CDSL files crashed with "Error parsing CAS header"Changes
New file:
casparser/process/cdsl_statement.pyComplete CDSL CAS parser that extracts:
Modified:
casparser/process/__init__.pyFileType.CDSLto the newprocess_cdsl_textparserModified:
casparser/process/nsdl_statement.pyparse_headerto search the full extracted text instead of justtext[:1000](the properly formatted date on some CAS statements falls beyond the first 1000 characters)Modified:
casparser/cli.pyformatINRto consistently produce 2 decimal places (previously dropped trailing zeros e.g.₹1,00,390.0→ now₹1,00,390.00)print_nsdlshowing Debts, Equities (demat), Mutual Funds (demat), Mutual Fund Folios totalsmax_width/overflowon Name column, fixed ISIN column width) to prevent content truncationTesting
Successfully parsed a 21-page CDSL CAS PDF containing:
All existing parsers (CAMS, Kfintech, NSDL) remain unchanged.