{"slug":"saylorinnovations-com-api-tax-crypto-gains-e93358","title":"Capital gain from a crypto sale by lot using FIFO, LIFO or HIFO, with cost basis","host":"saylorinnovations.com","method":"GET","resource":"https://saylorinnovations.com/api/tax/crypto-gains","category":"market","description":"Capital gain from a crypto sale by lot using FIFO, LIFO or HIFO, with cost basis, proceeds and the short-term and long-term split per lot.","price_listed":0.01,"price_asked":0.01,"state":"answering","state_label":"Answering","checks_7d":1,"answered_7d":1,"latency_ms_median":284,"reported_calls_30d":0,"reported_payers_30d":0,"networks":["eip155:137","eip155:42161","eip155:8453","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],"badge":"unverified","paid_checks_7d":0,"paid_ok_7d":0,"example_input":{"method":"GET","queryParams":{"lots":"[{\"date\":\"2024-01-10\",\"qty\":1,\"price\":42000},{\"date\":\"2025-03-05\",\"qty\":1,\"price\":85000}]","method":"hifo","sell_date":"2025-10-17","sell_price":"95000","sell_qty":"1.5"},"type":"http"},"output_schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"input":{"additionalProperties":false,"properties":{"method":{"enum":["GET"],"type":"string"},"queryParams":{"properties":{"lots":{"description":"JSON array of purchases: [{\"date\":\"YYYY-MM-DD\",\"qty\":1,\"price\":40000,\"fee\":0}]","type":"string"},"method":{"description":"optional fifo, lifo or hifo, default fifo","type":"string"},"sell_date":{"description":"sale date YYYY-MM-DD","type":"string"},"sell_price":{"description":"sale price per unit","type":"string"},"sell_qty":{"description":"quantity sold","type":"string"}},"required":["lots","sell_qty","sell_price","sell_date"],"type":"object"},"type":{"const":"http","type":"string"}},"required":["type","method"],"type":"object"},"output":{"properties":{"example":{"properties":{"average_cost_per_unit":{"description":"Cost basis divided by quantity sold","type":"number"},"cost_basis":{"description":"Cost of the matched lots including fees","type":"number"},"long_term_gain":{"description":"Gain on lots held longer than the threshold","type":"number"},"long_term_threshold_days":{"description":"Days after which a gain counts as long-term","type":"number"},"lots_used":{"description":"The purchase lots matched to the sale","items":{"properties":{"bought":{"description":"Purchase date","type":["string","null"]},"cost_basis":{"description":"Cost of that quantity including fees","type":["number","null"]},"gain":{"description":"Gain or loss on it","type":["number","null"]},"holding_days":{"description":"Days held","type":["number","null"]},"lot":{"description":"Position of the lot in the supplied list","type":["number","null"]},"proceeds":{"description":"Sale proceeds attributed to it","type":["number","null"]},"quantity":{"description":"Quantity taken from the lot","type":["number","null"]},"term":{"description":"short or long","type":["string","null"]}},"type":"object"},"type":"array"},"method":{"description":"Lot matching method used","type":"string"},"note":{"description":"Plain-language caveat about how to read and use the result","type":"string"},"proceeds":{"description":"Sale proceeds after the selling fee","type":"number"},"sell_date":{"description":"Sale date","type":"string"},"sell_price":{"description":"Sale price per unit","type":"number"},"sell_quantity":{"description":"Quantity sold","type":"number"},"short_term_gain":{"description":"Gain on lots held no longer than the threshold","type":"number"},"source":{"description":"Where the data or formula comes from","type":"string"},"total_gain":{"description":"Proceeds minus cost basis","type":"number"}},"required":["total_gain","lots_used"],"type":"object"},"type":{"const":"json","type":"string"}},"required":["type"],"type":"object"}},"required":["input"],"type":"object"},"history":[{"day":"2026-10-20","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.01,"price_match":true,"latency_ms":284,"error":null}],"description_full":"Capital gain from a crypto sale by lot using FIFO, LIFO or HIFO, with cost basis, proceeds and the short-term and long-term split per lot.","last_updated":"2026-10-20T14:51:58.411Z","schemes":["exact"]}