Xfina (Python Bindings)
Xfina is a blazingly fast library for parsing Indian financial statements (Bank Accounts, Credit Cards, Mutual Funds) and international brokers (IBKR), written in Rust and exposed to Python via PyO3.
It converts raw PDFs, Excel files, and CSVs into structured, ReBIT-compliant JSON dictionaries in milliseconds.
Installation
pip install xfina
Quick Start
The Python bindings expose the exact same parsing functions as the Rust core. Since it is backed by Rust, it requires raw bytes or string contents to be passed in, rather than file paths.
Parsing a Bank Statement (Excel)
import xfina
# Read the file as raw bytes
with open("hdfc_statement.xls", "rb") as f:
file_bytes = f.read()
# Parse it!
# The second argument is an optional password (None for Excel)
# The format parameter defaults to "xfina" if omitted, but can be "rebit"
account_data = xfina.parse_hdfc_ba(file_bytes, password=None, format="xfina")
print(f"Account Name: {account_data['profile']['holders']['holder'][0]['name']}")
Parsing a CAMS Mutual Fund Statement (PDF)
import xfina
import json
with open("cams_cas.pdf", "rb") as f:
file_bytes = f.read()
# Pass the password to decrypt the PDF
mf_data = xfina.parse_cams(file_bytes, password="PAN1234567")
# It returns a standard Python dictionary. You can easily dump it to JSON:
with open("output.json", "w") as f:
json.dump(mf_data, f, indent=2)
Parsing an IBKR Statement (CSV)
import xfina
# IBKR and HDFC Credit Card parsers expect a string (CSV content), not raw bytes
with open("ibkr_activity.csv", "r", encoding="utf-8") as f:
csv_content = f.read()
ibkr_data = xfina.parse_ibkr(csv_content, format="rebit")
Available Parsers
All parsers return a structured Python dictionary that mirrors the ReBIT JSON schema. Each parser accepts an optional format parameter which defaults to "xfina", but can be "rebit" for strict AA schema compliance without our extended data fields.
| Category | Institution | Format | Python Function | Input Type |
|---|---|---|---|---|
| Bank Account | HDFC | .xls |
parse_hdfc_ba(bytes, password=None, format=None) |
bytes |
| Bank Account | ICICI | .xls |
parse_icici_ba(bytes, filename=None, format=None) |
bytes |
| Bank Account | SBI | parse_sbi_ba(bytes, password=None, filename=None, format=None) |
bytes |
|
| Bank Account | BOB | .xls |
parse_bob_ba(bytes, format=None) |
bytes |
| Bank Account | Axis | .xls |
parse_axis_ba(bytes, filename=None, format=None) |
bytes |
| Credit Card | HDFC | CSV | parse_hdfc_cc(content, filename=None, format=None) |
str |
| Credit Card | ICICI | .xls |
parse_icici_cc(bytes, filename=None, format=None) |
bytes |
| Mutual Funds | CAMS | parse_cams(bytes, password=None, format=None, filename=None) |
bytes |
|
| Intl Stocks | IBKR | CSV | parse_ibkr(content, format=None) |
str |
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xfina-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: xfina-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90b2d8a3ff961dbb9427a501cf97f91312589441f58cd26b7f0eaa20954c070d
|
|
| MD5 |
f2bf65e0f97995dcf86b8056ea189231
|
|
| BLAKE2b-256 |
ca524d44f7f40988045e9900272f7bbdc48d276f78e964d3c1902284ed12277d
|
Provenance
The following attestation bundles were made for xfina-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl:
Publisher:
publish.yml on sakthipriyan/xfina
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xfina-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl -
Subject digest:
90b2d8a3ff961dbb9427a501cf97f91312589441f58cd26b7f0eaa20954c070d - Sigstore transparency entry: 2335877730
- Sigstore integration time:
-
Permalink:
sakthipriyan/xfina@6022e412b9da35b878941936568d12f28cf73ae4 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sakthipriyan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6022e412b9da35b878941936568d12f28cf73ae4 -
Trigger Event:
push
-
Statement type: