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: - acct (biweeklybudget.models.account.Account) – the Account this 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: the OFXStatement object
Return type: Raises: DuplicateFileException
-
_new_updated_counts()[source]¶ Return integer counts of the number of
OFXTransactionobjects 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: - acct (biweeklybudget.models.account.Account) – the Account this statement is for
- ofx (
ofxparse.ofxparse.Ofx) – Ofx instance for parsed file - stmt (biweeklybudget.models.ofx_statement.OFXStatement) – the OFXStatement for this statement
Returns: the OFXStatement object
Return type:
-
_update_investment(acct, ofx, stmt)[source]¶ Update a single OFX file for this Investment account.
Parameters: - acct (biweeklybudget.models.account.Account) – the Account this statement is for
- ofx (
ofxparse.ofxparse.Ofx) – Ofx instance for parsed file - stmt (biweeklybudget.models.ofx_statement.OFXStatement) – the OFXStatement for this statement
Returns: the OFXStatement object
Return type:
-
get_accounts()[source]¶ Query the database for all
ofxgetter-enabledAccountsthat have a non-emptybiweeklybudget.models.account.Account.ofxgetter_configand a non-Nonebiweeklybudget.models.account.Account.vault_creds_path. Return a dict of stringAccount nameto dict with keys:vault_path-vault_creds_pathconfig-ofxgetter_configid-idcat_memo-ofx_cat_memo_to_name
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
OFXStatementcreated by this run, int count of newOFXTransactioncreated, and int count ofOFXTransactionupdatedReturn type: Raises: RuntimeErroron error parsing OFX or unknown account type;DuplicateFileExceptionif the file (according to the OFX signon date/time) has already been recorded.
-