risk_propagation.account module¶
Configuration of a bank account
- class risk_propagation.account.Account(label, origin, initial_risk_score=None, delta=None, transaction=None)[source]¶
Bases:
object
Class containing information on a bank account
- __init__(label, origin, initial_risk_score=None, delta=None, transaction=None)[source]¶
Initializes an instance of Account
- Parameters:
label (
str
) – Identifier/label of the accountorigin (
Bank
) – The bank that the account belongs toinitial_risk_score (
Union
[float
,PaillierCiphertext
,None
]) – Optional initial risk_score of this accountdelta (
Optional
[float
]) – Optional delta associated to the accounttransaction (
Optional
[Transaction
]) – Optionally specify a transaction already
- add_transaction(transaction)[source]¶
Adds incoming transaction to account
- Parameters:
transaction (
Transaction
) – the transaction to add- Return type:
None
- property amounts: Generator[int, None, None]¶
A generator of all transaction amounts
- Returns:
a generator of all transaction amounts
- property delta: float¶
The delta that is used
- Returns:
delta
- Raises:
AttributeError – raised when delta is not set
- encrypt(public_key)[source]¶
Encrypt the risk score of the account
- Parameters:
public_key (
Union
[DistributedPaillier
,Paillier
]) – the public key to use in the encryption- Raises:
ValueError – raised when risk_score is already encrypted
- Return type:
None
- property label: str¶
Label of the account
- Returns:
the label of the account
- property linked_accounts: Set[Tuple[str, int]]¶
Accounts linked to this account together with there amount value (label, amount)
- Returns:
a collection of all account linked to this account
- property origin: Bank¶
The bank that possesses the information on this account
- Returns:
a bank
- property risk_score: float | PaillierCiphertext¶
Risk score of the account
- Returns:
current risk score
- Raises:
AttributeError – raised when risk score is not set
- property safe_risk_score: PaillierCiphertext¶
Encrypted risk score
- Returns:
current risk score
- Raises:
AttributeError – raised when risk score is not encrypted
- property total_income: int¶
Sum of all incoming transactions
- Returns:
total amount of incoming transactions
- property transactions: Transactions¶
The collection of all incoming transactions
- Returns:
the collection of incoming transactions