mikekchar / ledger-currencies

A ledger-cli tutorial to show how to deal with multiple currency transactions
52 stars 6 forks source link

cost basis example? #2

Open mgass opened 8 years ago

mgass commented 8 years ago

from 4.ledger, line 55-57:

; Important note: If you are calculating capital gains using ; average cost, you must do this very differently. I will ; provide an example later.

I have a situation in which I need to use average cost, but I haven't found a satisfying means of implementing this method in ledger. How did you do it?

mikekchar commented 8 years ago

I promised to do that, didn't I. I don't really remember how to do it now though. I'll play around and see if I can figure it out. The thing I remember is that it is very much easier that FIFO and LIFO, but that your lot prices will be screwed up and so the lot prices reports become useless....

Probably what you do is keep track of your current average buy price and use that as your lot price. And if I remember correctly, you can calculate your average buy price for a commodity using one of the reports... Sigh... It's been too long since I played with this.

mikekchar commented 8 years ago

Also, I should mention that I think http://furius.ca/beancount/ is set up for average cost. It is very similar to ledger, but has some things set up for tracking commodities more easily I think. I've never used it, but the author was very active on the ledger mailing list when I was reading it. He seemed to be very well respected.

mgass commented 8 years ago

thanks! He is indeed working to incorporate an average cost in beancount. There is a chance it won’t work for me since beancount does not use cost basis when converting between currencies. His average cost method may only work for other commodities(?).

FWIW, what I am looking for is something that will calculate the value of cash in your wallet, for example, in a currency other than the cash itself. We are wanting to do this because we set budgets in one currency (USD) but spend money against those budgets in a different currency (TZS), while the exchange rate between USD income and TZS cash fluctuates. It seems that the math used to calculate average cost is basically what I want. That is, the value in USD of TZS cash being spent is the average USD value of all the exchanges made to deposit TZS into the account.

No worries if this has been lost to you. I do appreciate your effort in putting up the tutorial. It has been helpful.

mikekchar commented 8 years ago

Ah. Interesting. I was actually doing that while I was living in London (although I was using FIFO). Yes, I'm almost certain average cost will be the simplest method. The biggest problem with FIFO or LIFO is that if you make a mistake it is a huge hassle. Sorry I've been slow at this. I got a bit snowed under at work. I'll probably get to it this weekend.