Fintech Lab
Lesson 74Crypto-fiat boundaryAdvanced
Tax-lot tracking: FIFO vs LIFO vs HIFO
You bought BTC at three different prices. Which 'cost basis' did you sell?

Crypto and FX positions have a cost-basis problem. A user buys 0.1 BTC at ₦60M/BTC, 0.1 BTC at ₦70M/BTC, and 0.1 BTC at ₦80M/BTC. Now they sell 0.15 BTC. Which lots did they sell? Tax outcomes depend entirely on the COST BASIS METHOD: FIFO (sell the oldest lots first) reports lower gain in a rising market; LIFO (sell the newest first) reports higher gain; HIFO (sell highest-cost first) minimizes taxable gain. Many crypto-fiat fintechs let users PICK the method (with tax-form generation reflecting the choice); regulators in some jurisdictions force FIFO. The ledger needs to track lots per user per asset: opening lot, lots consumed by each sale, remaining lot balance. This lesson posts a sale under FIFO and shows the per-lot consumption logic.

Fintech Lab is a free, interactive lab for fintech engineers. Real ledger, your own sandbox, engineering patterns from production. See all 85 lessons.

Search lessons

Type to find any of the 85 lessons. Press Enter to open.