Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Client library to support the Canadian Imperial Bank of Canadas API

Project description

CIBC API Client Wrapper

This package provides a client wrapper around CIBC's API. CIBC uses one API to handle requests from their web platform and app, specifically the API passes information about accounts, and transactions in those accounts. This Wrapper makes it easy to gather that data in python, given the primary account card number and password. Essentially, online banking through python.

Getting Started

Prerequisites

built for python 3.0 +, any operating system

pip install cibc

Basic Usage

Start with logging into a CIBC account by calling the cibc.CIBC method using your username and login

import cibc
c = cibc.CIBC('username (usually card number)', 'password')

Next, grab the accounts associated with this username and password (this is required, for any account specific information)

c.Accounts()
accounts = c.accounts

The accounts, which is a list of account class', is now storing all the account specific information. I'm no entirely sure what all of it is, but the account class variables are listed below. To get the transactions:

c.gTransactions(dateFrom=datetime.datetime(year=2018, month=9,day=1),dateUntil= datetime.datetime(year=2018, month=9, day=17))	

the gTransactions method gets all the transactions for all the accounts in the instance. It is also easy to get them one by one using the aquireTransactions method as follows:

for account in accounts:
	print(account.aquireTransactions())

which will return a list of transactions, each transaction being a dictionary of details.

Finally, there's an easy built in way to send the account transaction details to a csv file, or simply get a list of dictionaries without re-acquiring every transaction using the .tocsv() and .tolist() methods:

for account in accounts:
    account.tocsv('C:\Users\louis\Desktop\{}.csv'.format(account))
    print(account.tolist())

Summing and Subtracting Accounts

For your convenience, there's an easy way to combine accounts for looking at all transactions at once. The addition and subtraction methods are well defined for account classes and can be used like this:

omniAccount = sum(c.accounts) # all the account transactions in one account.  Account specific variables are lost
nomniAccount = c.accounts[0] - c.accounts[1]

Account subtraction returns an account instance with a balance of the first account balance minus the other account balance. It also holds the list of transactions excluding ones in account 1 that are also in account 2.

Contributing

thanks CIBC, for the API as well as being big enough for this to be relevant.

Versioning

We use (http://semver.org/) for versioning. For the versions available, see the (https://github.com/louismillette/CIBC).

Authors

  • Louis Millette

License

This project is licensed under the MIT License

Acknowledgments

  • CIBC. It's a good bank.

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
cibc-0.2.9-py3-none-any.whl (11.0 kB) Copy SHA256 hash SHA256 Wheel py3 Sep 29, 2018
cibc-0.2.9.tar.gz (7.6 kB) Copy SHA256 hash SHA256 Source None Sep 29, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page