Skip to content

AvishrantsSh/cas2json

 
 

Repository files navigation

Cas2JSON

code style: ruff

A library to parse CAS (Consolidated Account Statement) from providers like CAMS, KFINTECH, NSDL (BETA) and get related data in JSON format.

Installation

pip install -U cas2json

Usage

# 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.

License

Cas2JSON is distributed under GNU GPL v3 license. - IANAL

Credits

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

Resources

  1. CAS from CAMS
  2. CAS from Karvy/Kfintech

About

Serialise financial statements to python objects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.0%
  • Makefile 2.0%