Skip to content

Latest commit

 

History

1,007 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Streamlit Tests CI License: AGPL 3.0

Monopoly is a Python library & CLI that converts bank statement PDFs to CSV.

Supported banks:

Bank Credit Statement Debit Statement
Bank of America ✅ ✅
Bank of Montreal (BMO) ✅ ✅
Canadian Imperial Bank of Commerce (CIBC) ✅ ✅
Canadian Tire Bank ✅ ❌
Capital One Canada ✅ ❌
Chase ✅ ❌
Citibank ✅ ❌
DBS/POSB ✅ ✅
HSBC ✅ ❌
Maybank ✅ ✅
OCBC ✅ ✅
Royal Bank of Canada (RBC) ✅ ✅
Schwab Bank N/A ✅
Scotiabank ✅ ✅
Standard Chartered ✅ ❌
TD Canada Trust ✅ ✅
Trust ✅ ❌
UOB ✅ ✅
US Bank ✅ ❌
Zürcher Kantonalbank ❌ ✅

Install

Monopoly is a pip-installable Python package on PyPI under the name monopoly-core.

Since Monopoly uses pdftotext, you'll need to install additional dependencies:

apt-get install build-essential libpoppler-cpp-dev pkg-config ocrmypdf

or

brew install gcc@11 pkg-config poppler ocrmypdf

Then install with pipx:

pipx install monopoly-core

For additional OCR support:

pipx install 'monopoly-core[ocr]'

Usage

Monopoly runs in your terminal, allowing you to extract, transform and write bank statements to a CSV file.

To list commands and options:

monopoly --help

You can run it on a single statement

monopoly src/monopoly/examples/example_statement.pdf

or multiple statements

monopoly ./statements

To keep the output filename the same as the input (with a .csv extension), pass:

monopoly path/to/file.pdf --output ./out --preserve-filename

By default Monopoly writes a 4-column CSV. Pass --format json for a richer, versioned schema (schema_version, statement metadata, payment summary, and a stable per-transaction id):

monopoly path/to/file.pdf --output ./out --format json

Each transaction also carries currency (the statement's settlement currency), posting_date, a normalized direction ("credit"/"debit"), and a nullable account slot. Per-transaction FX/original-currency and account last-4 extraction are a planned follow-up (currently null).

If you need to run monopoly on a password protected file, ensure that passwords are set in the .env file:

cp .env.template .env
PDF_PASSWORDS=["password1","password2"]

Monopoly can also be run as a Python library:

python3 src/monopoly/examples/single_statement.py

Features

  • Parses PDFs using predefined configuration classes per bank.
  • Handles locked PDFs with credentials passed via environment variables.
  • Supports adding OCR for image-based bank statements.
  • Provides a generic parser that can be used without any predefined configuration (caveat emptor).
  • Includes a safety check (enabled by default) that validates totals for debit or credit statements.

Development

Want to add a bank but can't share a real statement? See CONTRIBUTING.md for the redacted text-fixture path (monopoly-fixture dump / build).

Clone the repo

git clone https://github.com/benjamin-awd/monopoly.git

Install dependencies using Homebrew

brew install make
make setup
brew bundle

About

Monopoly is a Python library & CLI that converts bank statement PDFs to CSV.

Topics

Resources

Contributing

Stars

426 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages