aeat.adapters.inbound.financial.providers._ofx module¶
OFX financial provider backed by ofxtools.
Provides OfxProvider, an
FinancialProvider
implementation that wraps ofxtools to ingest every statement block
exposed by an OFX or QFX file. The _OfxAccountLike,
_OfxStatementLike and _OfxTransactionLike Protocol surfaces let the
adapter type-check against the spec-validated aggregates ofxtools
returns without coupling to the library’s descriptor-driven model classes.
ofxtools is a strict, OFX-spec-conformant parser: it validates the
header, the SIGNON block, and every required statement element (a
BANKTRANLIST carries DTSTART / DTEND, an STMTRS carries a
LEDGERBAL) at conversion time, raising on a malformed document rather
than silently degrading. Real bank exports are spec-conformant, so the
strictness is a correctness gain over the previous permissive parser.
Each OFX transaction is projected into a
ParsedLedgerRow; the signed
TRNAMT value determines
TransactionDirection and the stored raw
transaction keeps the absolute magnitude plus OFX-native raw fields.
- class OfxProvider[source]¶
Bases:
FinancialProviderIngest raw transactions from OFX and QFX files.
Multi-statement OFX files emit transactions from every statement block; the provider names the account in the synthetic transaction id and copies the OFX-native fields (
ACCTID,TRNTYPE,DTPOSTED,TRNAMT,FITID,NAME,MEMO) intoraw_fieldsfor downstream auditing. The provider remains format-level: application ledger import owns persistence and bucket events.- name: ClassVar[str]¶
- supported_extensions: ClassVar[frozenset[str]]¶
- source_format: ClassVar[SourceFormat]¶
- verification_source: ClassVar[CorpusVerificationSource]¶
- provisional_pending_specimen: ClassVar[bool]¶
- validate_source(path)[source]¶
Validate that the OFX file can be parsed and carries at least one transaction.
- Return type:
- Returns:
A
ProviderValidationwith the validation outcome.- Parameters:
path (Path)
- ingest(path)[source]¶
Yield
ParsedLedgerRowrecords (magnitude + direction) from every OFX statement.- Return type:
- Parameters:
path (Path)