{"uid":"cap_Aa6YssmZhftTO9YJI3fyk","slug":"evm-canon-tax-lot-engine-fifo-lifo-hifo-cost-basis-matching-2059adbf","name":"EVM Canon Tax-Lot Engine (FIFO/LIFO/HIFO Cost-Basis Matching)","description":"Crypto tax-lot engine: FIFO/LIFO/HIFO cost-basis matching, realized gains and remaining inventory in exact decimal math","url":"https://evm-canon-base.onrender.com/lots","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["trades"],"properties":{"method":{"enum":["FIFO","LIFO","HIFO","ACB"],"type":"string","default":"FIFO"},"trades":{"type":"array","items":{"type":"object","required":["side","asset","amount","price","time"],"properties":{"fee":{"type":"string"},"side":{"enum":["buy","sell"],"type":"string"},"time":{"description":"unix seconds/millis or ISO-8601"},"asset":{"type":"string"},"price":{"type":"string","description":"unit price in the quote currency"},"amount":{"type":"string","description":"decimal string, never a float"}}}}}},"type":{"type":"string","const":"http"},"method":{"enum":["POST","PUT","PATCH"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.05","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.05/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_A-CnLNjaxJNtCHB1D2I4k","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.05","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Matches crypto trade disposals to acquisition lots using FIFO, LIFO, or HIFO accounting methods, returning realized gains and remaining inventory in exact decimal math.","exampleAgentPrompt":"Calculate my realized capital gains using FIFO cost-basis matching on these crypto trades — I bought 2 ETH at $1,800 and 1 ETH at $2,200, then sold 2 ETH at $3,000, and I need the exact gain per disposal plus remaining inventory.","exampleUseCases":[{"title":"End-of-year crypto tax reporting","prompt":"I need to calculate my realized gains for the year on my ETH and USDC trades using HIFO accounting — here are all my buys and sells, and I want to see the gain per disposal and what inventory is left."},{"title":"DeFi portfolio tax lot matching","prompt":"Can you run FIFO cost-basis matching on my Uniswap token swaps? I made several purchases of WBTC at different prices and sold portions over time — I need the exact realized gain for each disposal in precise decimal math."},{"title":"LIFO accounting for active trader","prompt":"I'm an active crypto trader and want to use LIFO for my tax lots — take these 15 ETH trades from this quarter, match each sale to the most recent purchases first, and show me the realized gain and remaining lots."}],"resultDescription":"Returns a structured breakdown of each disposal matched to one or more acquisition lots under the chosen method (FIFO, LIFO, or HIFO), including the cost basis of consumed lots, realized gain or loss per disposal in exact decimal arithmetic, and the remaining unmatched (unsold) inventory with their original acquisition prices and quantities.","failureModes":["Disposals exceed available acquisition quantity — insufficient inventory error","Malformed trade list (missing price, quantity, or timestamp fields) causing validation failure","Unsupported cost-basis method string returns an invalid method error","Decimal precision overflow or underflow for extremely small token quantities","Empty trade list returns empty result with no lots matched"],"whenToPreferThis":"Choose this endpoint when you need full tax-lot matching across multiple accounting methods (FIFO, LIFO, HIFO) with exact decimal precision, and you want both realized gains per disposal and remaining inventory in one response. Prefer it over the average-cost endpoint when per-lot granularity matters for tax reporting, and over the HIFO-only endpoint when you need the flexibility to switch accounting methods. Use the net-position endpoint instead if you only need overall asset balance without cost-basis matching.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T06:53:37.910Z","isFirstParty":false}