Skip to main content

OFX Generator

This repository provides a Python library for generating OFX (Open Financial Exchange) files. It includes data models, formatters, and a generator to create OFX 2.3 XML documents according to the OFX specification.

How to Use

Example: Generating an OFX File

  1. Create a Bank Statement: Define the financial institution, bank account, transactions, balance, and settings.

    from datetime import date
    from decimal import Decimal
    from ofx_generator.models import (
        Balance, BankAccount, BankStatement, CreditCardAccount, FinancialInstitution, OFXSettings, Transaction
    )
    from ofx_generator.standards import AccountType, Currency, Language, TransactionType
    
    fi = FinancialInstitution(org="Example Bank", fid="000")
    account = BankAccount(
        bank_id="000",
        branch_id="0000-0",
        account_id="000000000",
        account_type=AccountType.CHECKING,
    )
    transactions = [
        Transaction(
            transaction_type=TransactionType.PAYMENT,
            date_posted=date(2025, 1, 30),
            amount=Decimal("-100.00"),
            fit_id="202501300000",
            check_num="000",
            ref_num="000",
            memo="Payment to Vendor",
        ),
        Transaction(
            transaction_type=TransactionType.CREDIT,
            date_posted=date(2025, 1, 22),
            amount=Decimal("500.00"),
            fit_id="202501220000",
            check_num="000",
            ref_num="000",
            memo="Salary Payment",
        ),
    ]
    balance = Balance(amount=Decimal("1000.00"), date_as_of=date(2025, 1, 31))
    settings = OFXSettings(
        language=Language.PORTUGUESE,
        currency=Currency.BRAZILIAN_REAL,
        version=211,
    )
    credit_card_account = CreditCardAccount(
        cash_advance_available_amount=1000.00,
        cash_advance_credit_limit=5000.00
    )
    statement = BankStatement(
        financial_institution=fi,
        bank_account=account,
        transactions=transactions,
        balance=balance,
        start_date=date(2025, 1, 1),
        end_date=date(2025, 1, 31),
        settings=settings,
        credit_card_account=credit_card_account
    )
    
  2. Generate the OFX File: Use the OFXGenerator to create the OFX content and write it to a file.

    from ofx_generator.generator import OFXGenerator
    
    generator = OFXGenerator()
    trnuid = "1001"
    ofx_content = generator.generate(statement, trnuid)
    
    with open("output.ofx", "w", encoding="utf-8") as f:
        f.write(ofx_content)
    

Metadata

Release files for ofx-generator 0.1.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 ofx-generator 0.1.0
File Size Uploaded Provenance Actions
ofx_generator-0.1.0.tar.gz 4.7 kB Without provenance Details for ofx_generator-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ofx-generator 0.1.0
File Interpreter ABI Platform Actions
ofx_generator-0.1.0-py3-none-any.whl Python 3 none any Details for ofx_generator-0.1.0-py3-none-any.whl

Total release size: 7.6 kB

Release files / ofx_generator-0.1.0.tar.gz

Download URL ofx_generator-0.1.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c3cd39c370bc794628b45501d2a85964278235e3fffdd984d022e76c7a369ff1
BLAKE2b-256 checksum
How to use checksums
f940d90e68769e886e5000636a281d822e3845aa9bfd32a8c037133ca60068ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / ofx_generator-0.1.0-py3-none-any.whl

Download URL ofx_generator-0.1.0-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea741a3359e3f2e3b3c1889622ea96ce8dc08ccdceb5c10bdf9c84e5d29a8449
BLAKE2b-256 checksum
How to use checksums
226d816ac6da902bdf098bbd29412f36579dd5da0543081328d083d89aea4d85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Security for ofx-generator 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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