biweeklybudget.plaid_updater module

class biweeklybudget.plaid_updater.PlaidUpdateResult(item: biweeklybudget.models.plaid_items.PlaidItem, success: bool, updated: int, added: int, exc: Optional[Exception], stmt_ids: Optional[List[int]])[source]

Bases: object

Describes the result of updating a single account via Plaid.

as_dict
class biweeklybudget.plaid_updater.PlaidUpdater[source]

Bases: object

_do_item(item, days)[source]

Request transactions from Plaid for one Item. Update balances and transactions for each Account in that item.

Parameters:
  • item (PlaidItem) – the item to update
  • days (int) – number of days of transactions to get from Plaid
Return type:

PlaidUpdateResult

_get_transactions(access_token: str, start_dt: datetime.datetime, end_dt: datetime.datetime)[source]
_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
_stmt_for_acct(account: biweeklybudget.models.account.Account, plaid_acct_info: dict, plaid_txns: List[dict], end_dt: datetime.datetime)[source]

Put Plaid transaction data to the DB

Parameters:
  • account – the account to update
  • plaid_acct_info – dict of account information from Plaid
  • txns – list of transactions from Plaid
  • end_dt – current time, as of when transactions were retrieved
_update_bank_or_credit(end_dt: datetime.datetime, account: biweeklybudget.models.account.Account, plaid_acct_info: dict, plaid_txns: List[dict], stmt: biweeklybudget.models.ofx_statement.OFXStatement)[source]
_update_investment(end_dt: datetime.datetime, account: biweeklybudget.models.account.Account, plaid_acct_info: dict, stmt: biweeklybudget.models.ofx_statement.OFXStatement)[source]
classmethod available_items()[source]

Return a list of PlaidItem objects that can be updated via Plaid.

Returns:PlaidItem that can be updated via Plaid
Return type:list of PlaidItem objects
update(items=None, days=30)[source]

Update account balances and transactions from Plaid, for either all Plaid Items that are available or a specified list of Item IDs.

Parameters:
  • items (list or None) – a list of PlaidItem objects to update
  • days (int) – number of days of transactions to get from Plaid
Returns:

list of PlaidUpdateResult instances

Return type:

list