Automated Virtual Postings to Help Monitor Credit Card Usage

41 views
Skip to first unread message

Pranesh Prakash

unread,
Mar 5, 2019, 1:33:55 AM3/5/19
to hledger
Hello folks,
I have a credit card with a credit limit of ₹150,000.  When I use the credit card, I not only want to know how much I owe the bank (i.e., liability), but also how much remains of my credit limit.

So I want to calculate, ₹(150,000 - (Liabilities:Payable:Credit Card)).  Given that "line of credit" doesn't fall into any of the main accounts, I can't use real accounts to calculate it, and would need to use a virtual account and an automated transaction.

I looked at 
but I'm still having difficulty with additions/subtractions.

Ideally, I would like something like:
= Liabilities:Payable:Credit Card
    (Assets:Credit Card)   ₹150000-*1
or
= Liabilities:Payable:Credit Card
    (Assets:Credit Card)   ₹150000+*-1

But hledger doesn't work with "+" or "-" in the line.  I get the following error:

> unexpected '-'
> expecting ';', '=', '@', '{', digit, end of input, exponent, newline, or space

Is there anyway that I can do this using automated transactions?  Or are there any other suggestions on how to keep track of remaining credit limit?

Thanks,
Pranesh



Dmitry Astapov

unread,
Mar 5, 2019, 3:57:32 AM3/5/19
to hle...@googlegroups.com
Maybe it would be easier with balances?

~ 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] 
;; 

--
You received this message because you are subscribed to the Google Groups "hledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
D. Astapov

Simon Michael

unread,
Mar 5, 2019, 11:42:25 AM3/5/19
to hledger
That’s a clever way to see the percentage, at the cost of messing up the liability balance. 

Incidentally I’m still getting used to the way expenses still gets a budget goal assigned there. I suppose you could use an unbalanced transaction if you didn’t  wanted that.  

Pranesh, I think https://github.com/simonmichael/hledger/pull/934 would allow that. That pr needs some help. 

the.so...@gmail.com

unread,
Jan 24, 2021, 11:08:42 AM1/24/21
to hledger
Almost two years later, I think there's a better (though slightly hack-ish) solution to the problem, without using virtual accounts and automated transactions.  I thought I'd share it in case someone else comes across this post.

I now have an entry that says:
~~~
2018-11-05  Credit Card Limits
    Liabilities:Credit Card:Limit          ₹-150,000.00
    Liabilities:Credit Card:Bank1:Limit     ₹150,000.00
    Liabilities:Credit Card:Limit          ₹-200,000.00
    Liabilities:Credit Card:Bank2:Limit     ₹200,000.00
~~~

This way my liabilities don't get affected (the two liability entries cancel each other out), but when I specifically check the balance for the Bank1 card, the balance I want (limit - spent) is shown.

Regard,
Pranesh

Reply all
Reply to author
Forward
0 new messages