csb43.ofx

Partial implementation of a OFX file writer.

This package is not intended to fully implement the OFX Spec. Its final purpose is the conversion from CSB43 (norma 43 del Consejo Superior Bancario). That is, only transaction response is (partially) implemented.

References

[OFX] (1,2,3,4,5,6)

[http://www.ofx.net/] Open Financial Exchange, Specification 2.2 (nov 26, 2017). Intuit Inc. Envestnet

class csb43.ofx.Balance(tag_name: str = 'bal', sgml: bool = False, _elem_f: Callable[[str, Any | None], str] = <function xml_element>, _aggr_f: Callable[[str, Any | None], str] = <function xml_aggregate>, amount: int | float | Decimal | None = None, date: dt.datetime | dt.date | None = None)

a balance

See [OFX] 11.4.4.1

Fields

amount

field <BALAMT>

date

field <DTASOF>

class csb43.ofx.BankAccount(tag_name: str = 'bankaccfrom', sgml: bool = False, _elem_f: Callable[[str, Any | None], str] = <function xml_element>, _aggr_f: Callable[[str, Any | None], str] = <function xml_aggregate>, bank_id: str | None = None, branch_id: str | None = None, id: str | None = None, type: str = 'SAVINGS', key: str | None = None)

A bank account

See [OFX] 11.3.1 Banking Account

Fields

bank_id

BANKID bank identifier (Spain: banco, entidad)

branch_id

BRANCHID branch identifier (Spain: sucursal, oficina)

id

ACCTID account identifier

type

ACCTTYPE type of account.

key

ACCTKEY checksum (Spain: digitos de control)

class csb43.ofx.File(tag_name: str = 'ofx', sgml: bool = False, _elem_f: Callable[[str, Any | None], str] = <function xml_element>, _aggr_f: Callable[[str, Any | None], str] = <function xml_aggregate>, responses: list[Response] = <factory>)

An OFX file

See [OFX] 2.4.1

Fields

responses

class csb43.ofx.Payee(tag_name: str = 'payeeid', sgml: bool = False, _elem_f: Callable[[str, Any | None], str] = <function xml_element>, _aggr_f: Callable[[str, Any | None], str] = <function xml_aggregate>, name: str | None = None, payee: str | None = None, extended_name: str | None = None)

payee info

Fields

name

<NAME>

payee

<PAYEE>

extended_name

<EXTDNAME>

class csb43.ofx.Response(tag_name: str = 'stmtrs', sgml: bool = False, _elem_f: Callable[[str, Any | None], str] = <function xml_element>, _aggr_f: Callable[[str, Any | None], str] = <function xml_aggregate>, currency: AnyCurrency | None = None, account_from: BankAccount | None = None, transaction_list: TransactionList | None = None, ledger_balance: Balance | None = None, available_balance: Balance | None = None, balances: list[Balance] = <factory>, mktginfo: Any | None = None)

STMTRS

See [OFX] 11.4.2.2 Response

class csb43.ofx.SignOnResponse(tag_name: str = 'sonrs', sgml: bool = False, _elem_f: Callable[[str, Any | None], str] = <function xml_element>, _aggr_f: Callable[[str, Any | None], str] = <function xml_aggregate>)

SONRS

See [OFX] 2.5.1

class csb43.ofx.Transaction(tag_name: str = 'stmttrn', sgml: bool = False, _elem_f: Callable[[str, Any | None], str] = <function xml_element>, _aggr_f: Callable[[str, Any | None], str] = <function xml_aggregate>, type: str = 'OTHER', date_posted: dt.datetime | dt.date | None = None, date_initiated: dt.datetime | dt.date | None = None, date_available: dt.datetime | dt.date | None = None, amount: int | float | Decimal | None = None, transaction_id: str | None = None, correct_fit_id: str | None = None, correct_action: str | None = None, server_tid: str | None = None, check_num: str | None = None, ref_num: str | None = None, standard_industrial_code: str | None = None, payee: Payee | None = None, bank_account_to: BankAccount | None = None, cc_account_to: BankAccount | None = None, memo: str | None = None, image_data: Any | None = None, origin_currency: AnyCurrency | None = None, origin_amount: int | float | Decimal | None = None, inv401ksource: Any | str = None, payeeid: str | None = None, name: str | None = None, extended_name: str | None = None)

A OFX transaction

See [OFX] 11.4.4.1

class csb43.ofx.TransactionList(tag_name: str = 'banktranlist', sgml: bool = False, _elem_f: Callable[[str, Any | None], str] = <function xml_element>, _aggr_f: Callable[[str, Any | None], str] = <function xml_aggregate>, date_start: dt.datetime | dt.date | None = None, date_end: dt.datetime | dt.date | None = None, transactions: list[Transaction] = <factory>)

Transaction list aggregate

Converter

Conversion from AEB43 to OFX

csb43.ofx.converter.PAYMODES = {1: TransactionType.CHECK, 2: TransactionType.CREDIT, 3: TransactionType.SRVCHG, 4: TransactionType.XFER, 5: TransactionType.DIV, 7: TransactionType.REPEATPMT, 8: TransactionType.FEE, 9: TransactionType.DIV, 10: TransactionType.CHECK, 11: TransactionType.ATM, 12: TransactionType.POS, 15: TransactionType.XFER, 17: TransactionType.INT, 99: TransactionType.OTHER}

conversion table OFX - Homebank for pay modes

csb43.ofx.converter.convert_from_aeb43(batch: Batch, sgml=False) File

convert an AEB43 batch to OFX.

Use sgml=True in order to generate SGML instead of XML