A library to parse CAS (Consolidated Account Statement) from providers like CAMS, KFINTECH, NSDL (BETA) and get related data in JSON format.
pip install -U cas2json# For CAMS/KFINTECH
from cas2json import parse_cams_pdf
data = parse_cams_pdf("/path/to/cams/file.pdf", "password")
# For NSDL
from cas2json import parse_nsdl_pdf
data = parse_nsdl_pdf("/path/to/nsdl/file.pdf", "password")
# To get data in form of Python dict
from dataclasses import asdict
python_dict = asdict(data)
# To convert the data from python dict to JSON
from msgspec import json
json_data = json.encode(python_dict)
Notes:
- All used types like transaction types can be found under
cas2json/enums.py. - NSDL currently supports only parsing of holdings since the transactions history is not complete.
Cas2JSON is distributed under GNU GPL v3 license. - IANAL
This library is inspired by CASParser, but it is an independent reimplementation with significant changes in both design and processing logic. In particular, it introduces a revised method for parsing textual data and for accurately identifying transaction values, even in cases where one or more trailing values may be missing from the record.
This project is not affiliated with or endorsed by the original CASParser author