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
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: - 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-enabled
Accounts
that have a non-emptybiweeklybudget.models.account.Account.ofxgetter_config
and a non-Nonebiweeklybudget.models.account.Account.vault_creds_path
. Return a dict of stringAccount name
to dict with keys:vault_path
-vault_creds_path
config
-ofxgetter_config
id
-id
cat_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
OFXStatement
created by this run, int count of newOFXTransaction
created, and int count ofOFXTransaction
updatedReturn type: 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.
-