# EVM Canon Tax-Lot Engine (FIFO/LIFO/HIFO Cost-Basis Matching)

> EVM Canon Tax-Lot Engine (FIFO/LIFO/HIFO Cost-Basis Matching) is a paid API for AI agents from evm-canon-base.onrender.com, paid per call via x402, $0.05/call, status unknown (last checked 2026-09-15).

Matches crypto trade disposals to acquisition lots using FIFO, LIFO, or HIFO accounting methods, returning realized gains and remaining inventory in exact decimal math.

## Facts

- Endpoint: POST https://evm-canon-base.onrender.com/lots
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/evm-canon-tax-lot-engine-fifo-lifo-hifo-cost-basis-matching-2059adbf
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Aa6YssmZhftTO9YJI3fyk

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability evm-canon-tax-lot-engine-fifo-lifo-hifo-cost-basis-matching-2059adbf -d '<json body>'
```

Example prompt: 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.

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

Crypto tax-lot engine: FIFO/LIFO/HIFO cost-basis matching, realized gains and remaining inventory in exact decimal math

## Output

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.

## Request schema (JSON Schema)

```json
{
 "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"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/evm-canon-tax-lot-engine-fifo-lifo-hifo-cost-basis-matching-2059adbf/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from evm-canon-base.onrender.com](https://www.zero.xyz/host/evm-canon-base.onrender.com/llms.txt)
