About This Title

Pages:
Published: June 2022
ISBN: 9783982454320
In Print

Tracking Personal Finances Using Python

by Siddhant Goel

In this book, you’ll build your personalized multi banking application powered entirely by Python. The Python ecosystem contains an excellent package called Beancount that provides data structures and command line utilities for working with money. This book will show you how to use Beancount to maintain double-entry accounting records of all your financial transactions in a plain-text file, and use the CLI/web tools Beancount provides to work with this ledger. The final result will be a Git repository on your computer where you can view and edit everything related to your money.


This book is intended only as an informative guide for those wishing to learn more about Python programming and personal financial transactions. In no way is this book intended to replace, countermand, or conflict with best bookkeeping practices, accounting standards, or financial regulations in your region or anywhere else.


This work was written and produced entirely by the author. We are proud to be distributing it.

eBook Formats:

  • PDF for desktop/tablets

  • epub for Apple Books, e-readers

  • mobi for Kindle readers

Get all eBook formats here for $13.99 (USD)

Add to Cart we accept visa, mastercard, amex, discover, paypal


Beancount is an excellent piece of software that provides a command line implementation of the double-entry accounting system. At its core, it gives you data structures for working with money, a language specification for defining financial transactions in a plain-text format, and CLI scripts that tie everything together.

A Beancount-driven workflow involves maintaining a ledger of all your financial transactions in a plain-text file and using CLI/GUi tools to interact with this ledger, analyze your past financial behavior, show your spending patterns, and much more. This book walks the reader through building such a workflow from scratch.

We start with introducing the reader to plain-text accounting and double-entry bookkeeping. In the next chapter, we talk about Beancount, the different tools that it provides its users, and what a Beancount-driven workflow looks like. Next, we help the reader build such a workflow for themselves. Using a lot of sample code, we help the reader set up a “finances” git repository on their disk and write code to convert transactions from their bank(s) into the Beancount file format. This chapter is quite heavy on code, which is why we follow up with writing tests for this code using pytest. The final chapter describes the CLI and GUI tools that the Beancount ecosystem gives the reader. All these tools help the reader generate various reports for their financial life, both on the console (using CLI tools) and in a graphical format (using a web application).

What You Need

The code in this book was written using Python 3.9.1 and tested using pytest 6.2.1. All the code has been tested on a Linux computer, but is likely to run in a POSIX environment.

Resources

Releases:

  • P2.0 2022/08/30
  • P1.0 2022/06/04

Contents & Extracts

  • Introduction
    • Background
    • Requirements
  • Plain Text Accounting
  • Beancount
    • Workflow
    • Directory Structure
    • Beancount File Format
    • Beancount Tools
    • Conclusion
  • Workflow
    • Step 0: Setup
    • Step 1: Getting transactions
    • Step 2: Converting transactions
    • Step 3: Adding transactions
    • Step 4: Archiving transactions
    • Conclusion
  • Testing
    • Introduction
    • Regression Testing using Beancount
    • Writing ImporterTestCase
    • Conclusion
  • Reporting
    • Introduction
    • bean-report
    • bean-web
    • bean-query
    • Fava
  • Closing Thoughts

Author

Siddhant Goel is a senior software engineer and open-source maintainer based in Munich, Germany. He has been writing Python code for more than a decade now, and is the primary maintainer of multiple open-source modules written in Python published on the PyPI.

eBook Formats:

  • PDF for desktop/tablets

  • epub for Apple Books, e-readers

  • mobi for Kindle readers

Get all eBook formats here for $13.99 (USD)

Add to Cart we accept visa, mastercard, amex, discover, paypal

Related Titles:

About This Title

Pages:
Published: June 2022
ISBN: 9783982454320
Edition: 1
In Print