Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

banker-0.1.0.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

banker-0.1.0-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page