> On Sep 14, 2015, at 1:27 AM, Kyle Spaans <[email protected]>
> wrote:
>
> On Mon, 14 Sep 2015 at 03:39 Michael Toomim <[email protected]
> <mailto:[email protected]>> wrote:
> I need a FIFO algorithm to calculate capital gains. Since ledger doesn't
> support this,
>
> I'm not sure what you mean, have you seen this section of the manual?
> http://ledger-cli.org/3.0/doc/ledger3.html#Commodity-prices
> <http://ledger-cli.org/3.0/doc/ledger3.html#Commodity-prices>
>
> Ledger doesn't explicitly do FIFO cost basis calculations, but if you
> maintain each "lot" of a commodity that you buy, you can specify that lot
> when selling and Ledger can calculate the gains automatically. (I *think*
> that ledger may assume a FIFO order when you sell a commodity, but I'm not
> positive.)
I've read that. The problem is that ledger requires you to manually specify
which lots you are selling from with each sale. (Ledger does *not* assume a
FIFO order.) I have hundreds of sales on my books, and need to automate it.
Ledger doesn't give you a way to automate it within ledger, so I am trying to
export the data to external python tools to automate it.
> 2. Exporting all csv data to python
> So maybe I can just filter transactions from python. Unfortunately, the csv
> export still exports postings, and I need to see them grouped by transaction.
>
> For instance, these transactions:
>
> 2014-1-1 bought food
> Expenses:food $4
> Assets:cash
>
> 2014-1-1 bought food
> Expenses:food $4
> Assets:cash
>
> Are these examples of the assets that you'd like to calculate capital gains
> for, or just examples for the CSV export?
Here are some better examples. Every exchange with bitcoin is a taxable event,
and requires capital gains to be calculated.
2014-1-1 sold bitcoin
Assets:bitcoin 4 btc @ $250
Assets:cash -$1,000
2014-1-1 sold bitcoin
Assets:bitcoin 3 btc @ $250
Assets:cash -$7500
2014-1-1 bought truck
Expenses:vehicle $4,000
Assets:bitcoin -17.39 btc @ $230
2014-1-1 sold kangaroo
Income:zoo -42 btc @ $210
Assets:bitcoin $8820
So to find all capital gains events, we need to search the ledger for
transactions where bitcoin comes in or out of Assets:bitcoin and enters/exits
another category as USD.
But the only way I've found to do this with ledger is ... to move all the data
outside of ledger. And ledger doesn't provide any good ways to export
transactions. So I had to manually copy it into a spreadsheet. So much for
ledger.
This made me sad.
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.