Skip to main content

Cas2JSON

code style: ruff

A library to parse CAS (Consolidated Account Statement) from providers like CAMS, KFINTECH, NSDL (BETA) , CDSL (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")

# For CDSL
from cas2json import parse_cdsl_pdf

data = parse_cdsl_pdf("/path/to/cdsl/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/CDSL currently supports only parsing of holdings since the transactions history is not complete.

License

Cas2JSON is distributed under GNU AGPL 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

Metadata

Release files for cas2json 1.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cas2json 1.2.7
File Size Uploaded
cas2json-1.2.7.tar.gz 34.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cas2json 1.2.7
File Interpreter ABI Platform
cas2json-1.2.7-py3-none-any.whl Python 3 none any Details

Total release size: 86.5 kB

Release files / cas2json-1.2.7.tar.gz

Download URL cas2json-1.2.7.tar.gz
Size 34.4 kB
Tags Source
SHA-256 checksum
How to use checksums
80bf82e9e5c9e49f3d5e800d2f7ffac5c8c9bc7ceed8de02fdc70307f676853b
BLAKE2b-256 checksum
How to use checksums
dcabdd03751011e575f2325b5076a3274d3ab3e2ce4a4f1db9e202174b06b661
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / cas2json-1.2.7-py3-none-any.whl

Download URL cas2json-1.2.7-py3-none-any.whl
Size 52.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77fb8f8448618e2140dbd10d315139cfcd0155d7ff6e31499ea9d2157f16071c
BLAKE2b-256 checksum
How to use checksums
b4bbdd37d23c6d6e626c1e7e0a665e535d287c7a28ad79b13a70ba3047baa5e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.2.7 This release

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page