(Karvy/Kfintech/CAMS) Consolidated Account Statement (CAS) PDF parser
Project description
CASParser
Parse Consolidated Account Statement (CAS) PDF files generated from CAMS/KFINTECH
Installation
pip install casparser
with faster PyMuPDF parser
pip install casparser[mupdf]
Note: Enabling this dependency could result in licensing changes. Check the License section for more details
Usage
import casparser
data = casparser.read_cas_pdf('/path/to/cas/pdf/file.pdf', 'password')
Data structure
{
"statement_period": {
"from": "YYYY-MMM-DD",
"to": "YYYY-MMM-DD"
},
"file_type": "CAMS/KARVY/UNKNOWN",
"investor_info": {
"email": "string",
"name": "string",
"mobile": "string",
"address": "string"
},
"folios": [
{
"folio": "string",
"amc": "string",
"PAN": "string",
"KYC": "OK/NOT OK",
"PANKYC": "OK/NOT OK",
"schemes": [
{
"scheme": "string",
"advisor": "string",
"rta_code": "string",
"rta": "string",
"open": "number",
"close": "number",
"valuation": {
"date": "date",
"nav": "number",
"value": "number"
},
"transactions": [
{
"date": "YYYY-MM-DD",
"description": "string",
"amount": "number",
"units": "number",
"nav": "number",
"balance": "number",
"is_dividend_payout": "boolean",
"is_dividend_reinvestment": "boolean",
"dividend_rate": null
}
]
}
]
}
]
}
CLI
casparser also comes with a command-line interface that prints summary of parsed portfolio in a wide variety of formats.
Usage: casparser [-o output_file.json] [-p password] [-s type] [-a] CAS_PDF_FILE
-o, --output FILE Output file path
-s, --summary simple|plain|grid|fancy_grid|html...
Print Summary of transactions parsed.
-p PASSWORD CAS password
-a, --include-all Include schemes with zero valuation in the
summary output
--force-pdfminer Force PDFMiner parser even if MuPDF is
detected
--version Show the version and exit.
-h, --help Show this message and exit.
Demo
License
CASParser is distributed under MIT license by default. However enabling the optional dependency
mupdf
would imply the use of PyMuPDF /
MuPDF and hence the licenses GNU GPL v3 and GNU Affero GPL v3
would apply. Copies of all licenses have been included in this repository. - IANAL
Resources
PS:- select the detailed statement (including transactions) option
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for casparser-0.3.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4cfca75c742f012f0059fd3fa1e74b900b70379676b0f3d3cbd27ddee494ec9 |
|
MD5 | 22d5bf0dcb9afb093334f365b5814f87 |
|
BLAKE2b-256 | dfcbab9372ff6eef4e33367676887df96f40d8e3e6247ed92c968e8c0fb93b4b |