Skip to main content

ipb-python-wrapper

Python wrapper for Investec Programmable Banking

Investec Open API

This package is a wrapper for the Investec OpenAPI. More information on the API is available here.

Prerequisites

  • Python 3.7 or later

Installation

Requires python 3.7 or above. Available via pypi package manager

pip install investec-openapi-wrapper

Usage

Authorization

The Account Information and Programmable Card API endpoints are protected by the OAuth 2.0 Authorization Framework. More information is available here

from personal_banking_client import PersonalBankingClient
client = PersonalBankingClient(credentials_path=file_path)

where the credentials file looks as follows:

{
    "client_id": "test", 
    "secret": "test"
}

Personal Banking Client

The Account Information API allows Investec SA Private Banking clients to access their account and transactional information (read-only) via an API. More information is available here

get_accounts

Lists all the users accounts.

accounts = client.get_accounts()

Example Response

{"accounts": 
    [{
        "accountId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx", 
        "accountNumber": "xxxxxxxxxxx", 
        "accountName": "Mrs J Smith", 
        "referenceName": "Investec (Main)", 
        "productName": "Private Bank Account", 
        "kycCompliant": True, 
        "profileId": "xxxxxxxxxxxxxx"
    }]
}

get_account_balance

Get the current balance for the specified account

balance = client.get_account_balance('account_id')

Example Response

{
    "accountId": "xxxxxxxxxxxxxxxxxxxxxxxxx", 
    "currentBalance": 1000.00, 
    "availableBalance": 11000.00, 
    "currency": "ZAR"
}

get_account_transactions

Lists all transactions for a specified account. Optional additional fields allow the user to specify a date range to filter transactions for.

transactions = client.get_account_transactions('account_id')

start_date = datetime.today()-timedelta(days=1)
end_date = datetime.today()
transactions = client.get_account_transactions('account_id', from_date = start_date)
transactions = client.get_account_transactions('account_id', to_date = end_date)
transactions = client.get_account_transactions('account_id', from_date = start_date, to_date=end_date)

Example Response

{"transactions": 
    [
        {
            "accountId": "xxxxxxxxxxxxxxxxxxxxxxxxxx", 
            "type": "CREDIT", 
            "transactionType": None, 
            "status": "POSTED", 
            "description": "Interest Value Date 01Jan23", 
            "cardNumber": "", 
            "postedOrder": 0, 
            "postingDate": "2023-01-03", 
            "valueDate": None, 
            "actionDate": "2023-01-01", 
            "transactionDate": "2023-01-01", 
            "amount": 100.00, 
            "runningBalance": 11000.00
        }  
    ]
}

transfer_multiple

Transfer funds between two internal accounts. The account IDs can be retrieved using the get_accounts function.

transfer_details = [{
        "beneficiaryAccountId": "destination account ID",
        "amount": "1.01", # in Rand
        "myReference": "Reference for source account",
        "theirReference": "Reference for destination account"
}]
response = client.transfer_multiple('account_id', transfer_details)

pay_multiple

Pay multiple benificiaries. Benificiary details can be retrieved using the get_beneficiaries function.

payments_details = [{
        "beneficiaryId": "Beneficiary ID",
        "amount": "1.01", # in Rand
        "myReference": "Reference for source account",
        "theirReference": "Reference for beneficiary"
}]
response = client.pay_multiple()

get_beneficiaries

Get a list of beneficiaries.

beneficiaries = client.get_beneficiaries()

Example result:

[{
    "beneficiaryId": "xxxxxxxxxxxxxxxxxxx", 
    "accountNumber": "xxxxxxxxxx", 
    "code": "xxxxxx", 
    "bank": "Some bank", 
    "beneficiaryName": "Some beneficiary", 
    "lastPaymentAmount": "500.00", 
    "lastPaymentDate": "21/03/2023", 
    "cellNo": 00000000000, 
    "emailAddress": "test@email.com", 
    "name": "Some beneficiary", 
    "referenceAccountNumber": "Their reference", 
    "referenceName": "My reference", 
    "categoryId": "xxxxxxxxxxxxxx", 
    "profileId": "xxxxxxxxxxxxxx"
}]

get_beneficiary_categories

Get a list of configured beneficiary categories.

beneficiary_categories = client.get_beneficiary_categories()

Example Result

[{
    "id": "xxxxxxxxxxxxxx", 
    "isDefault": "true", 
    "name": "Not Categorised"    
}]

Build pypi package

python -m build
python -m twine upload dist/*

Metadata

Release files for investec-openapi-wrapper 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for investec-openapi-wrapper 0.0.2
File Size Uploaded
investec-openapi-wrapper-0.0.2.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for investec-openapi-wrapper 0.0.2
File Interpreter ABI Platform
investec_openapi_wrapper-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / investec-openapi-wrapper-0.0.2.tar.gz

Download URL investec-openapi-wrapper-0.0.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3034a744e2d4d35c37a8d716b5bada3e09e8448428a10e535faf91f4d96765fc
BLAKE2b-256 checksum
How to use checksums
8c7f5f484b050cbb82032560aed5b610dc6d12bf9fc225f1dc776090960798dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.2

Release files / investec_openapi_wrapper-0.0.2-py3-none-any.whl

Download URL investec_openapi_wrapper-0.0.2-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
864a394ad1b1297d9714520e9a3f9d7de998decdacec0eccac846862b5c86262
BLAKE2b-256 checksum
How to use checksums
35437786b8047818b9cca6181d9da95eb96b648aacc73b7fd72b7c2f07ce4012
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page