Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Managing Personal Finances using Python

Managing Personal Finances using Python

Siddhant Goel

May 15, 2019
Tweet

More Decks by Siddhant Goel

Other Decks in Technology

Transcript

  1. Disclaimers I'm not a nancial advisor. Aim is to show

    you what's possible. Following slides may or may not contain some maths.
  2. siddhant@localhost ~/finances % tree . . ├── config.py ├── main.beancount

    ├── originals │ └── dkb │ └── 2019 │ ├── credit │ │ │── 01-jan.csv │ │ └── 02-feb.csv │ └── ec │ │── 01-jan.csv │ └── 02-feb.csv ├── poetry.lock └── pyproject.toml
  3. bean-report main.beancount balances siddhant@localhost ~/finances % bean-report main.beancount balances Assets:DKB

    1450.00 EUR Income:BigCorp 3000.00 EUR Expenses:Rent -1500.00 EUR Expenses:Food 50.00 EUR
  4. main.beancount ; Date format - YYYY-MM-DD option "title" "Mustermann" option

    "operating_currency" "EUR" 2019-10-01 open Assets:DKB 2019-10-01 open Income:BigCorp 2019-10-01 open Expenses:Food 2019-10-01 open Expenses:Rent 2019-10-25 "*" "Überweisung BigCorp" Assets:DKB 3000.00 EUR Income:BigCorp -3000.00 EUR 2019-11-01 "*" "Miete" Assets:DKB -1500.00 EUR Expenses:Rent 1500.00 EUR 2019-11-02 "*" "Essen" Assets:DKB -50.00 EUR Expenses:Food 50.00 EUR 2019-10-26 balance Assets:DKB 3000.00 EUR 2019-11-03 balance Expenses:Food 50.00 EUR
  5. config.py from beancount_dkb import ECImporter, CreditImporter CONFIG = ( ECImporter(

    'DE99 9999 9999 9999 9999 99', 'Assets:DKB', 'EUR', file_encoding='ISO-8859-1', ), CreditImporter( '1234********5678', 'Assets:DKB', 'EUR', file_encoding='ISO-8859-1', ), )
  6. Sample Importer from beancount.core.amount import Amount from beancount.core.number import Number

    from beancount.ingest.importer import ImporterProtocol class SampleImporter(ImporterProtocol): # ... def identify(self, file_): """Check if file_ is from the bank we're supposed to work with """ # ... def extract(self, file_): """Read file_, and emit a list of beancount data structures """
  7. Budgeting 2012-01-01 custom "budget" Expenses:Coffee "daily" 4.00 EUR 2013-01-01 custom

    "budget" Expenses:Books "weekly" 20.00 EUR 2014-02-10 custom "budget" Expenses:Groceries "monthly" 40.00 EUR 2015-05-01 custom "budget" Expenses:Electricity "quarterly" 85.00 EUR 2016-06-01 custom "budget" Expenses:Holiday "yearly" 2500.00 EUR