biweeklybudget.models.account module

class biweeklybudget.models.account.Account(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, biweeklybudget.models.base.ModelAsDict

_sa_class_manager = {'acct_type': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'all_balances': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'all_statements': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'apr': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'credit_limit': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'interest_class_name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'is_active': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'min_payment_class_name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'negate_ofx_amounts': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'ofx_cat_memo_to_name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'ofxgetter_config_json': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'plaid_account': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'plaid_account_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'plaid_item_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'prime_rate_margin': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 're_interest_charge': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 're_interest_paid': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 're_late_fee': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 're_other_fee': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 're_payment': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'reconcile_trans': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'scheduled_transactions': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'transactions': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'vault_creds_path': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
acct_type

Type of account (Enum AcctType )

all_statements

Relationship to all OFXStatement for this Account

apr

Finance rate (APR) for credit accounts

balance

Return the latest AccountBalance object for this Account.

Returns:latest AccountBalance for this Account
Return type:biweeklybudget.models.account_balance.AccountBalance
credit_limit

credit limit, for credit accounts

description

description

effective_apr

Return the effective APR for a credit account. If prime_rate_margin is not Null, return that added to the current US Prime Rate. Otherwise, return apr.

Returns:Effective account APR
Return type:decimal.Decimal
for_ofxgetter

Return whether or not this account should be handled by ofxgetter.

Returns:whether or not ofxgetter should run for this account
Return type:bool
id

Primary Key

interest_class_name

Name of the biweeklybudget.interest._InterestCalculation subclass used to calculate interest for this account.

is_active

whether or not the account is active and can be used, or historical

is_budget_source

Return whether or not this account should be considered a funding source for Budgets.

Returns:whether or not this account is a Budget funding source
Return type:bool
is_stale

Return whether or not there is stale data for this account.

Returns:whether or not data for this account is stale
Return type:bool
last_interest_charge

Return the amount of the last interest charge for this account. Raise an exception if one could not be identified.

Returns:amount of last interest charge for this account
Return type:decimal.Decimal
min_payment_class_name

Name of the biweeklybudget.interest._MinPaymentFormula subclass used to calculate minimum payments for this account.

name

name for the account

negate_ofx_amounts

For use in reconciling our Transaction entries with the account’s OFXTransaction entries, whether or not to negate the OfxTransaction amount. We enter Transactions with income as negative amounts and expenses as positive amounts, but most bank OFX statements will show the opposite.

ofx_cat_memo_to_name

whether or not to concatenate the OFX memo text onto the OFX name text; for banks like Chase that use the memo for run-on from the name

ofx_statement

Return the latest OFXStatement for this Account.

Returns:latest OFXStatement for this Account
Return type:biweeklybudget.models.ofx_statement.OFXStatement
ofxgetter_config

Return the deserialized ofxgetter_config_json dict.

Returns:ofxgetter config
Return type:dict
ofxgetter_config_json

JSON-encoded ofxgetter configuration

plaid_account

PlaidAccount this account is linked with

plaid_account_id

Plaid Token for this account

plaid_configured

Return whether or not this account is configured for Plaid.

Returns:whether or not this account is configured for Plaid.
Return type:bool
plaid_item_id

Plaid Item ID for this account

prime_rate_margin

Margin added to the US Prime Rate to determine APR, for credit accounts.

re_interest_charge

regex for matching transactions as interest charges

re_interest_paid

regex for matching transactions as interest paid

re_late_fee

regex for matching transactions as late fees

re_other_fee

regex for matching transactions as other fees

re_payment

regex for matching transactions as payments

reconcile_trans

Include Transactions and OFXTransactions from this account when reconciling. Set to False to exclude accounts that are investment, payment only, or otherwise won’t have a matching Transaction for each OFXTransaction.

set_balance(**kwargs)[source]

Create an AccountBalance object for this account and associate it with the account. Add it to the current session.

set_ofxgetter_config(config)[source]

Set ofxgetter configuration.

Parameters:config (dict) – ofxgetter configuration
unreconciled

Return a query to match all unreconciled Transactions for this account.

Parameters:db (sqlalchemy.orm.session.Session) – active database session to use for queries
Returns:query to match all unreconciled Transactions
Return type:sqlalchemy.orm.query.Query
unreconciled_sum

Return the sum of all unreconciled transaction amounts for this account.

Returns:sum of amounts of all unreconciled transactions
Return type:float
vault_creds_path

path in Vault to read the credentials from

class biweeklybudget.models.account.AcctType[source]

Bases: enum.Enum

An enumeration.

Bank = 1
Cash = 4
Credit = 2
Investment = 3
Other = 5
as_dict
transferrable_types = <bound method AcctType.transferrable_types of <enum 'AcctType'>>[source]
exception biweeklybudget.models.account.NoInterestChargedError(acct)[source]

Bases: Exception

Exception raised when an Account does not have an OFXTransaction for interest charged within the last 32 days.