Reading operations¶
Note
Starting from version 3, all of the methods on this page can return a NeedTANResponse
instead of actual
data if your bank requires a TAN. You should then enter a TAN, read our chapter Working with TANs to find out more.
Fetching your bank accounts¶
The most simple method allows you to get all bank accounts that your user has access to:
- class fints.client.FinTS3Client(bank_identifier, user_id, customer_id=None, from_data: bytes = None, product_id=None, product_version='4.0.0', mode=FinTSClientMode.INTERACTIVE)[source]
- get_sepa_accounts()[source]
Returns a list of SEPA accounts
- Returns:
List of SEPAAccount objects.
This method will return a list of named tuples of the following type:
- class fints.models.SEPAAccount(iban, bic, accountnumber, subaccount, blz)¶
You will need this account object for many further operations to show which account you want to operate on.
Fetching bank information¶
During the first interaction with the bank some meta information about the bank and your user is transmitted from the bank.
- class fints.client.FinTS3Client(bank_identifier, user_id, customer_id=None, from_data: bytes = None, product_id=None, product_version='4.0.0', mode=FinTSClientMode.INTERACTIVE)[source]
- get_information()[source]
Return information about the connected bank.
Note: Can only be filled after the first communication with the bank. If in doubt, use a construction like:
f = FinTS3Client(...) with f: info = f.get_information()
Returns a nested dictionary:
bank: name: Bank Name supported_operations: dict(FinTSOperations -> boolean) supported_formats: dict(FinTSOperation -> ['urn:iso:std:iso:20022:tech:xsd:pain.001.003.03', ...]) supported_sepa_formats: ['urn:iso:std:iso:20022:tech:xsd:pain.001.003.03', ...] accounts: - iban: IBAN account_number: Account Number subaccount_number: Sub-Account Number bank_identifier: fints.formals.BankIdentifier(...) customer_id: Customer ID type: Account type currency: Currency owner_name: ['Owner Name 1', 'Owner Name 2 (optional)'] product_name: Account product name supported_operations: dict(FinTSOperations -> boolean) - ...
Fetching account balances¶
You can fetch the current balance of an account with the get_balance
operation.
- class fints.client.FinTS3Client(bank_identifier, user_id, customer_id=None, from_data: bytes = None, product_id=None, product_version='4.0.0', mode=FinTSClientMode.INTERACTIVE)[source]
- get_balance(account: SEPAAccount)[source]
Fetches an accounts current balance.
- Parameters:
account – SEPA account to fetch the balance
- Returns:
A mt940.models.Balance object
This method will return a list of Balance
objects from the mt-940
library. You can find more information
in their documentation.
Reading account transactions¶
You can fetch the banking statement of an account within a certain timeframe with the get_transactions
operation.
- class fints.client.FinTS3Client(bank_identifier, user_id, customer_id=None, from_data: bytes = None, product_id=None, product_version='4.0.0', mode=FinTSClientMode.INTERACTIVE)[source]
- get_transactions(account: SEPAAccount, start_date: date = None, end_date: date = None)[source]
Fetches the list of transactions of a bank account in a certain timeframe.
- Parameters:
account – SEPA
start_date – First day to fetch
end_date – Last day to fetch
- Returns:
A list of mt940.models.Transaction objects
- get_transactions_xml(account: SEPAAccount, start_date: date = None, end_date: date = None) list [source]
Fetches the list of transactions of a bank account in a certain timeframe as camt.052.001.02 XML files. Returns both booked and pending transactions.
- Parameters:
account – SEPA
start_date – First day to fetch
end_date – Last day to fetch
- Returns:
Two lists of bytestrings containing XML documents, possibly empty: first one for booked transactions, second for pending transactions
This method will return a list of Transaction
objects from the mt-940
library. You can find more information
in their documentation.
Fetching holdings¶
You can fetch the holdings of an account with the get_holdings
method:
- class fints.client.FinTS3Client(bank_identifier, user_id, customer_id=None, from_data: bytes = None, product_id=None, product_version='4.0.0', mode=FinTSClientMode.INTERACTIVE)[source]
- get_holdings(account: SEPAAccount)[source]
Retrieve holdings of an account.
- Parameters:
account – SEPAAccount to retrieve holdings for.
- Returns:
List of Holding objects
This method will return a list of Holding
objects:
- class fints.models.Holding(ISIN, name, market_value, value_symbol, valuation_date, pieces, total_value, acquisitionprice)¶