Created
July 5, 2021 13:18
-
-
Save isaacharrisholt/a234dffe9dd3042ba890a66ec60da91c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import quiffen | |
from datetime import datetime | |
qif = quiffen.Qif() | |
acc = quiffen.Account('Personal Bank Account', desc='My personal bank account with Barclays.') | |
qif.add_account(acc) | |
groceries = quiffen.Category('Groceries') | |
essentials = quiffen.Category('Essentials') | |
groceries.add_child(essentials) | |
print(groceries.render_tree()) | |
# Groceries (root) | |
# └─ Essentials | |
qif.add_category(groceries) | |
tr = quiffen.Transaction(date=datetime.now(), amount=150.0) | |
acc.add_transaction(tr, header='Bank') | |
print(qif.to_qif()) # If a path is provided, this will save the file too! | |
# !Type:Cat\nNGroceries\nETrue\nIFalse\n^\nNGroceries:Essentials\nETrue\nIFalse\n^\n!Account\nNPersonal Bank Account\nDMy | |
# personal bank account with Barclays.\n^\n!Type:Bank\nD02/07/2021\nT150.0\n^\n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment