biweeklybudget.ofxapi.local module

class biweeklybudget.ofxapi.local.OfxApiLocal(db_sess)[source]

Bases: object

_create_statement(acct, ofx, mtime, filename)[source]

Create an OFXStatement for this OFX file. If one already exists with the same account and filename, raise DuplicateFileException.

Parameters:
Returns:

the OFXStatement object

Return type:

biweeklybudget.models.ofx_statement.OFXStatement

Raises:

DuplicateFileException

_new_updated_counts()[source]

Return integer counts of the number of OFXTransaction objects that have been created and updated.

Returns:2-tuple of new OFXTransactions created, OFXTransactions updated
Return type:tuple
_update_bank_or_credit(acct, ofx, stmt)[source]

Update a single OFX file for this Bank or Credit account.

Parameters:
Returns:

the OFXStatement object

Return type:

biweeklybudget.models.ofx_statement.OFXStatement

_update_investment(acct, ofx, stmt)[source]

Update a single OFX file for this Investment account.

Parameters:
Returns:

the OFXStatement object

Return type:

biweeklybudget.models.ofx_statement.OFXStatement

get_accounts()[source]

Query the database for all ofxgetter-enabled Accounts that have a non-empty biweeklybudget.models.account.Account.ofxgetter_config and a non-None biweeklybudget.models.account.Account.vault_creds_path. Return a dict of string Account name to dict with keys:

Returns:dict of account names to configuration
Return type:dict
update_statement_ofx(acct_id, ofx, mtime=None, filename=None)[source]

Update a single statement for the specified account, from an OFX file.

Parameters:
  • acct_id (int) – Account ID that statement is for
  • ofx (ofxparse.ofxparse.Ofx) – Ofx instance for parsed file
  • mtime (datetime.datetime) – OFX file modification time (or current time)
  • filename (str) – OFX file name
Returns:

3-tuple of the int ID of the OFXStatement created by this run, int count of new OFXTransaction created, and int count of OFXTransaction updated

Return type:

tuple

Raises:

RuntimeError on error parsing OFX or unknown account type; DuplicateFileException if the file (according to the OFX signon date/time) has already been recorded.