Author

Topic: [ANN] cryptocurrency capital gains calculator for ledger (Read 1066 times)

newbie
Activity: 2
Merit: 0
This is a little tool for helping with capital gain calculation for crypto currencies. It uses ledger-cli.org style account books and spits out a csv file like the following:
...

You can get it here: https://github.com/redfish64/bitcoin-tax-calculator


Hi,
I started with "hledger" and tried to import csv trades...
Are you still working with ledger and scritping?
newbie
Activity: 32
Merit: 0
This is a little tool for helping with capital gain calculation for crypto currencies. It uses ledger-cli.org style account books and spits out a csv file like the following:

Short term Trades
SharesSymbolBuy DateSell DateSell PriceBuy PriceGainRunning Total GainRefs
XXXFOO2015-10-222015-10-22XXXXXXXXXXXXS: bittrex.dat:43 foo.dat:44 B: foo_adj.dat:7
XXXFOO2015-10-222015-10-22XXXXXXXXXXXXS: foo_adj.dat:7 B: foo_adj.dat:7
XXXBTC2015-09-272015-10-25XXXXXXXXXXXXS: poloniex_adj.dat:10 B: bittrex.dat:55
Long term Trades
SharesSymbolBuy DateSell DateSell PriceBuy PriceGainRunning Total GainRefs
XXXBTC2013-09-012015-04-29XXXXXXXXXXXXS: electrum_wallet1.dat:7-17 B: btc-e.dat:39
XXXBTC2013-09-012015-08-12XXXXXXXXXXXXS: electrum_wallet1.dat:24 kraken.dat:8-38 B: btc-e.dat:39
XXXBTC2013-09-012015-08-19XXXXXXXXXXXXS: electrum_wallet1.dat:33 B: btc-e.dat:39
Remaining balances:
SharesSymbolBuy DateBuy PriceRefs
XXXAUG2015-08-19XXXelectrum_wallet1.dat:33
XXXTAU2015-08-21XXXmasterxchange.dat:1
XXXTAU2015-08-31XXXmasterxchange.dat:6

The "Refs" column pointa to the file number, line number(s) of the individual ledger posting used, so it's easy to track what this program does. Each line shows the "S", sale, and "B", buy of the coin, and intra-day entries are combined. For example, on line 1, bittrex.dat:43 means the bittrex.dat ledger file, line 43, and an example ledger entry might be:

2015-10-22 12:45:01 * Trade
   Assets:bittrex           XXX BTC
   Assets:bittrex           -XXX FOO


WARNING: I just added a large portion to this for ledger and multi crypto currency support and am the only user as far as I know, so there may be bugs lurking. This is GNU licensed.

You can get it here: https://github.com/redfish64/bitcoin-tax-calculator
Jump to: