Metadata-Version: 2.4
Name: beancount-india
Version: 0.2.0
Summary: Beancount importers for Indian financial institutions
Keywords: beancount,beangulp,hdfc,india
Author: Arpan Kapoor
Author-email: Arpan Kapoor <a@arpankapoor.com>
License-Expression: GPL-2.0-only
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Office/Business :: Financial :: Accounting
Classifier: Typing :: Typed
Requires-Dist: beangulp>=0.2.0
Requires-Dist: msoffcrypto-tool ; extra == 'sbi'
Requires-Dist: python-calamine ; extra == 'sbi'
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/arpankapoor/beancount-india
Project-URL: Issues, https://github.com/arpankapoor/beancount-india/issues
Project-URL: Repository, https://github.com/arpankapoor/beancount-india
Provides-Extra: sbi
Description-Content-Type: text/markdown

# beancount-india

Beancount importers for Indian financial institutions.

## Installation

```console
uv add beancount-india
```

## HDFC Bank

### Account statements

On the HDFC NetBanking Account Statement page, download the statement in
**Delimited** format. Supported filenames have this form:

`Acct_Statement_XXXXXXXX1234_01012025.txt`

Transactions use their value dates. When possible, the importer derives an
opening balance from the first transaction in the statement.

### Credit card statements

On the HDFC Bank Get Statement page, download a past statement in **CSV**
format. Supported filenames have this form:

`Jan2025_Billedstatements_1234_06-01-25_20-46.csv`

Purchases produce negative liability postings; payments and refunds produce
positive postings. Nonzero reward points are included as `reward_points`
metadata.

### Configuration

Configure the importers with full account or card numbers mapped to their
Beancount accounts. Numbers must be strings; filenames are matched using their
final four digits.

```python
import beangulp

from beancount_india.hdfc import HDFCAccountImporter, HDFCCardImporter

ingest = beangulp.Ingest(
    [
        HDFCAccountImporter({"12345678901234": "Assets:HDFC:Account"}),
        HDFCCardImporter({"1234567890123456": "Liabilities:HDFC:Card"}),
    ]
)

if __name__ == "__main__":
    ingest()
```

## State Bank of India

Install the SBI statement dependencies:

```console
uv add "beancount-india[sbi]"
```

On the SBI Statements page, download the statement in **Excel** format.
Supported filenames have this form:

`AccountStatement_01012025_120000.xlsx`

Configure full SBI account numbers with their Beancount accounts and statement
passwords. A password may be a string or a zero-argument callable:

```python
import os

from beancount_india.sbi import SBIAccountConfig, SBIAccountImporter

sbi = SBIAccountImporter(
    {
        "12345678901": SBIAccountConfig(
            account="Assets:Bank:SBI",
            password=lambda: os.environ["SBI_STATEMENT_PASSWORD"],
        )
    }
)
```

Transactions use their statement dates. When possible, the importer derives
an opening balance from the first transaction.
