Skip to content

Instantly share code, notes, and snippets.

@barrucadu
Created March 1, 2019 10:14
Show Gist options
  • Select an option

  • Save barrucadu/6fe952232e28e8e6290457610f8ced8a to your computer and use it in GitHub Desktop.

Select an option

Save barrucadu/6fe952232e28e8e6290457610f8ced8a to your computer and use it in GitHub Desktop.
; treat the remaining balance on the credit card as an asset.
2019-01-01 Got a new credit card
assets:creditcard £10000.00
liabilities:creditcard
2019-02-01 Spending some money on my credit card
expenses:ducks £100.00
assets:creditcard
2019-03-01 Spending some more money on my credit card
expenses:geese £100.00
assets:creditcard
; $ hledger balance -H creditcard
; £9800.00 assets
; £9800.00 creditcard
; £-10000.00 liabilities
; £-10000.00 creditcard
; --------------------
; £-200.00
; treat the money spent on the credit card as a liability.
2019-02-01 Spending some money on my credit card
expenses:ducks £100.00
liabilities:creditcard
2019-03-01 Spending some more money on my credit card
expenses:geese £100.00
liabilities:creditcard
; $ hledger balance -H creditcard
; £-200.00 liabilities
; £-200.00 creditcard
; --------------------
; £-200.00
@adept

adept commented Mar 1, 2019

Copy link
Copy Markdown
~ monthly from 2019-02-01
  liabilities:creditcard  -£10000
  expenses

2019-02-01 Spending some money on my credit card
    expenses:ducks                                                       £100.00
    liabilities:creditcard

2019-02-02 Spending some more money on my credit card
    expenses:geese                                                       £100.00
    liabilities:creditcard

;; hledger balance -f creditcard-balance.ledger --budget
;; Budget performance in 2019/02/01-2019/02/02:
;; 
;;                         ||         2019/02/01-2019/02/02 
;; ========================++===============================
;;  expenses               ||  £200.00 [   2% of £10000.00] 
;;  liabilities            || £-200.00 [   2% of   £-10000] 
;;  liabilities:creditcard || £-200.00 [   2% of   £-10000] 
;; ------------------------++-------------------------------
;;                         ||        0 [                 0] 
;; 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment