No project description provided
Project description
Banker
Banker is a wrapper around nordigen APIs in order to obtain banking transactions. To use Banker, it is necessary to create an account at nordigen and obtain individual secret keys, more on that below.
Installation
pip3 install banker
Usage
1. First time setup
To use Banker, it is first required to sign up at nordigen and thereafter create secret keys at the following link. Afterwards, a auth.yaml file can be generated using the following, together with the generated secret_id and secret_key from nordigen.
>>> import banker
>>> secret_id = "SECRET_ID_FROM_NORDIGEN"
>>> secret_key = "SECRET_KEY_FROM_NORDIGEN"
>>> client = banker.Client()
>>> client.add_keys(secret_id, secret_key)
After running the above, an auth.yaml file will be created in the same folder. It is no longer necessary to use the secret_id and secret_key since everything will be stored in
the auth.yaml file.
2. Create and sign agreement with a bank.
Next, we would like to create a connection with a single bank. In order to do this, a unique id for an institution is needed. In this example, we are interested in connecting all accounts from Swedbank (if you have any), which can be done in the following way.
>>> client = banker.Client()
# We need to find the unique institution_id for swedbank.
>>> client.search_institution("swedbank")
[{'id': 'SWEDBANK_SWEDSESS',
'name': 'Swedbank',
'bic': 'SWEDSESS',
'transaction_total_days': '730',
'countries': ['SE'],
'logo': 'https://cdn.nordigen.com/ais/SWEDBANK_LONG_SWEDSESS.png',
'payments': False}]
# With the 'id' above we can submit a requisition and sign an agreement. Open the following link and proceed to sign the agreement.
>>> client.submit_requisition("SWEDBANK_SWEDSESS")
'https://ob.nordigen.com/psd2/start/..../SWEDBANK_SWEDSESS'
3. List available accounts and get transactions, balances, etc.
Now it is possible to list all accounts that are available from the banks that you have signed an agreement with.
>>> client.accounts()
{'SWEDBANK_SWEDSESS': ['YOUR_SWEDBANK_ACCOUNT_ID_1', 'YOUR_SWEDBANK_ACCOUNT_ID_2'], 'NORWEGIAN_SE_NORWNOK1': ['YOUR_NORWEGIAN_ACCOUNT_ID_1']}
# With one account_id above, get all transactions from the last 90 days.
>>> client.transactions("YOUR_ACCOUNT_ID")
A lot of output, which varies between different banks.
# It is also possible to obtain account balance.
>>> client.account_balance("YOUR_ACCOUNT_ID")
{'balances': [{'balanceAmount': {'amount': 'AMOUNT_HERE', 'currency': 'SEK'}, 'balanceType': 'interimAvailable'}, {'balanceAmount': {'amount': 'AMOUNT_HERE', 'currency': 'SEK'}, 'balanceType': 'interimBooked'}]}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file banker-0.1.0.tar.gz
.
File metadata
- Download URL: banker-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.4 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48ada99498b771f6030ec46328cee64fc79abe1540ca020a4d51bc0fbbc25a0b |
|
MD5 | 8cb44f2befd2738f1dcd88576782d8d0 |
|
BLAKE2b-256 | ca925de9295d4e2e3681e5ef65be6d1a1fea1fa28b71afbbfa9a22d56243377e |
File details
Details for the file banker-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: banker-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.4 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4fcd069dea9cd0b6ea8a22cdb12a72c4cf96b485856d0858750848f30a41eca |
|
MD5 | 4a74cd4c8def6a0ed8eb0c0db133c789 |
|
BLAKE2b-256 | 48228abd0145e9b0e8c7e33971ce30bbf737422c8db8144d53292989f1fe04fd |