Hello Everyone. Excited to be here and see how this grows. I stumbled upon hledger in late 2022, and it has become a fun rabbit hole.

Hledger has been phenomenal for my banking purposes, but I am trying to find a good workflow for cryptocurrency.

I tried hledger-lots but stumbled upon installation/configuration (which is upon myself as recently switching to linux) but also see that it is based on FIFO, and I would also like LIFO and HIFO

My main work flow is that I record each purchase made into its own asset category based on date purchase with a note of the cost basis.

Upon selling I just take from the available assets/date category until it zeros out and then I move onto the next.

I don’t actively day trade so this is manageable for myself, yet reaching out here as always looking for more efficient ways.

I currently keep three separate journals for FIFO, LIFO and HIFO (US tax reporting) to decide which will be best for my reporting at end of year. After I report end of year, I disregard the other two and build upon the one used to keep an accurate record of cryptocurrency available.

*#Purchase ABC coin at 100.00 USD per coin*
2024-02-15 USD to ABC
    revenue:cash          -100.00 USD
    equity:conversion      100.00 USD
    equity:conversion     -1.0000 ABC
    assets:20240215       1.0000 ABC ; 100.00
    revenue:cash            -2.00 USD
    expenses:fees            2.00 USD

*#Purchase ABC coin at 200.00 USD per coin*
2024-02-28 USD to ABC
    revenue:cash          -100.00 USD
    equity:conversion      100.00 USD
    equity:conversion     -0.5000 ABC
    assets:20240228        0.5000 ABC ; 200.00
    revenue:cash            -2.00 USD
    expenses:fees            2.00 USD

*#Sell .25 ABC coin at 500.00 USD per coin*
2024-03-06 ABC to USD
    assets:20240215      -0.2500 ABC @@ 125.00 USD
    equity:conversion                   125.00 USD
    equity:conversion                  -125.00 USD
    revenue:cash                        125.00 USD
    revenue:cash                       -1.00 USD
    expenses:fees                       1.00 USD
1 Like

Welcome @ralf! What you describe is pretty much how I have done it in my experiments: using per-lot subaccounts. Which then must be carefully preserved - including costs and balance assertions - through transfers and file end/starts. That could get quite challenging if you have many lots, eg from recurring rewards or similar. Especially when you want to fix an error or improve the bookkeeping a few years back. hledger close --show-costs, hledger-move.hs, and emacs power tools (search/replace, macros, align-regexp, ledger-mode’s M-q…) can be helpful.

I don’t see much explicit @ COST in your example, I guess you track it in comments more than I.

I have never experimented with anything other than FIFO, I like that you can compare the different strategies.

PS hope you don’t mind that I fixed your example’s formatting… I have been suffering through that on Reddit for so many years… but NOW… :joy: :star_struck: :exploding_head:


I was going to try with the @COST again as this might be easier going forward. I still have much to learn on reporting and such. Yes emacs, I have been wanting to learn this specifically for org mode, but can see now the other useful benefits I can get from here. The rewards, and costs moving in/out exchanges/wallets is challenging for keeping accurate. The formatting happened as I was watching and the page refreshed, I was like, ah cool, but how did I do that :slight_smile:

1 Like

Hi ralf! From what I understand, docker-finance may be exactly what you’re looking for:

I don’t know what wallet/chain/exchange you’re using but, with docker-finance and (not direct linking but they provide a service that calculates the FIFO/LIFO/etc. for you), you may be able to automate almost everything you’re trying to do (checkout the “Taxes” section in “Screenshots”).

For anything that can’t be automated, docker-finance has a system in place that allows you to easily add custom comments on a per-transaction (or per-subaccount or per-whatever-tag-or-column-you-want-thanks-to-hledger-rules) basis as needed (even with emacs, if you’d like).

1 Like

Apologies for the brevity, ralf. If you need help setting this up, please feel free to reach out to me anytime.