API reference¶
to_ofx and write_ofx, exported from bankstatementparser_writer_ofx,
generated from the docstrings by mkdocstrings.
bankstatementparser_writer_ofx.writer
¶
Structured Open Financial Exchange (OFX) Writer.
to_ofx(data, bank_id='123456789', account_id=None, account_type='CHECKING', currency='EUR')
¶
Serialise bank transactions into standard OFX 1.02 format.
Every value taken from the records or the arguments is escaped, so record text can never open or close an OFX element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Sequence[Transaction] | DataFrame | Sequence[Mapping[str, Any]] | Any
|
Transactions as DataFrame, Transaction list, or dict records. |
required |
bank_id
|
str
|
Routing / Bank identifier. |
'123456789'
|
account_id
|
str | None
|
Account identifier (inferred from first transaction if None). |
None
|
account_type
|
str
|
Account type (default 'CHECKING', e.g. 'SAVINGS', 'CREDITLINE'). |
'CHECKING'
|
currency
|
str
|
ISO 4217 Currency code (default 'EUR'). |
'EUR'
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted OFX document string. |
Source code in bankstatementparser_writer_ofx/writer.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
write_ofx(data, destination, bank_id='123456789', account_id=None, account_type='CHECKING', currency='EUR')
¶
Write transactions to an OFX file on disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Sequence[Transaction] | DataFrame | Sequence[Mapping[str, Any]] | Any
|
Transactions as DataFrame, Transaction list, or dict records. |
required |
destination
|
str | PathLike[str]
|
Filesystem destination path. |
required |
bank_id
|
str
|
Routing / Bank identifier. |
'123456789'
|
account_id
|
str | None
|
Account identifier. |
None
|
account_type
|
str
|
Account type. |
'CHECKING'
|
currency
|
str
|
ISO Currency code. |
'EUR'
|
Returns:
| Type | Description |
|---|---|
Path
|
Path object pointing to the written file. |
Source code in bankstatementparser_writer_ofx/writer.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |