Skip to main content

Xfina Logo

Xfina (Python Bindings)

Crates.io PyPI npm

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 same entry point as the Rust core. To keep the core parsing logic as pure functions without side-effects (like file I/O), the library requires raw bytes to be passed in rather than file paths.

Parsing a Credit Card Statement

import xfina

with open("statement.xls", "rb") as fh:
    data = fh.read()

# Hand over the bytes; the format is worked out from the content.
statement = xfina.parse(data, filename="statement.xls")

statement["format"]       # "ba-hdfc"
statement["area"]         # "personal", or "public" for rate sheets and price histories
statement["category"]     # "bank_account"
statement["institution"]  # "HDFC Bank"
statement["detection"]    # how it was identified, plus the file's metadata
statement["validation"]   # the two-level validation report
statement["data"]         # the account, in the requested schema

# ReBIT output, or a pinned format that skips detection:
xfina.parse(data, schema="rebit")
xfina.parse(data, **{"as": "ba-hdfc"})

Failures raise xfina.XfinaParseError, which is where this differs from the JS binding: exceptions are the idiom here, so the same information arrives as attributes rather than in an error envelope.

try:
    xfina.parse(data, filename=name)
except xfina.XfinaParseError as e:
    if e.kind == "password_required":
        prompt_for_password(e.format)   # the format the filename suggested

The functions

Function Purpose
parse(bytes, password=None, filename=None, modified_timestamp=None, **{"as": None}, schema=None) Identify and parse a statement.
detect(bytes, password=None, filename=None, modified_timestamp=None) Identify a statement without parsing it.
formats() Every format this build knows, with id, area, category, institution, containers and enabled.
version() The version of the parsers actually running.
series_coverage(data) For the data of a price history parse: first and last date, rows with a value, and gaps. Of that one file.
series_csv(data) The same data as CSV, in Tiingo's column layout.

Metadata

Release files for xfina 0.10.0

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

Source distribution (sdist)

Source distribution for xfina 0.10.0
File Size Uploaded Provenance Actions
xfina-0.10.0.tar.gz 289.3 kB With provenance Details for xfina-0.10.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for xfina 0.10.0
File Actions
xfina-0.10.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for xfina-0.10.0-cp38-abi3-win_amd64.whl
xfina-0.10.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for xfina-0.10.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
xfina-0.10.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for xfina-0.10.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
xfina-0.10.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for xfina-0.10.0-cp38-abi3-macosx_11_0_arm64.whl
xfina-0.10.0-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for xfina-0.10.0-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 13.7 MB

Release files / xfina-0.10.0.tar.gz

Download URL xfina-0.10.0.tar.gz
Size 289.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bf8c38b7d99e392826926a9ea3741024365c6bf2af3cd626fc9073601b6b7b19
BLAKE2b-256 checksum
How to use checksums
99b9db924f26ffc9633b2a664c2d684509faaa9d0ae005fe691232b5b645d760
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / xfina-0.10.0-cp38-abi3-win_amd64.whl

Download URL xfina-0.10.0-cp38-abi3-win_amd64.whl
Size 2.5 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f6690065bbdd0cb55c2997a34f12b065762cd6f9f8a5e34834b74beb831d1fbf
BLAKE2b-256 checksum
How to use checksums
14f1dc9250b3b47f93e7e21d54f02a17d640b78fafded0e1e98d28e3461cc089
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / xfina-0.10.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL xfina-0.10.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.9 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
5b9958814c0f0fd82655d862f9e4492c076b56e07c214e9e658e35035945adec
BLAKE2b-256 checksum
How to use checksums
3e202967aa1b0727d58b392c675190daffc8270245b222927bf26192d34e02a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / xfina-0.10.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL xfina-0.10.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.9 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
bb23cda596528ba6d5a3d212f8d174c526ef9d8bb738fea74cd0e19cdbed9f80
BLAKE2b-256 checksum
How to use checksums
f0ce099cce3189d8b6c2e2628072075e3c9188dd9ccaec91534654a38e8b315f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / xfina-0.10.0-cp38-abi3-macosx_11_0_arm64.whl

Download URL xfina-0.10.0-cp38-abi3-macosx_11_0_arm64.whl
Size 2.6 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1d8e6531522cdd647cdc33b11f491a7b6627fefd449767bb5c210705e2ca20ff
BLAKE2b-256 checksum
How to use checksums
2abd31b48fed4b0266fe8b69a4e4211d986f97c681cb510bc69ee41ab2149373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / xfina-0.10.0-cp38-abi3-macosx_10_12_x86_64.whl

Download URL xfina-0.10.0-cp38-abi3-macosx_10_12_x86_64.whl
Size 2.6 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
79e11f4c46956103790c6ed861cdf3748061d710dd9f634872df7689f44c630a
BLAKE2b-256 checksum
How to use checksums
b1416b15c848a20e4604641367d525c74af9297aea39b39e080dc47d56717fc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for xfina 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for xfina-0.10.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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