# EVM Canon Base – FIFO Cost-Basis Lot Matching

> EVM Canon Base – FIFO Cost-Basis Lot 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 trade lots using FIFO (first-in, first-out) order and computes realized gain per disposal using exact decimal arithmetic

## Facts

- Endpoint: POST https://evm-canon-base.onrender.com/lots/fifo
- 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-base-fifo-cost-basis-lot-matching-5c415838
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_U8jQ_XD6q-tLZMIHmsvay

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-base-fifo-cost-basis-lot-matching-5c415838 -d '<json body>'
```

Example prompt: I need to calculate my realized capital gains using FIFO lot matching — here are my acquisition lots and disposals for ETH trades; consume the oldest lots first and give me the exact gain on each disposal.

## When to prefer this

Choose this endpoint when you need strict FIFO (first-in, first-out) cost-basis matching with exact decimal arithmetic — the standard method required by many tax jurisdictions for cryptocurrency. Prefer this over HIFO (which minimizes gains by consuming highest-cost lots first) or average-cost basis when the user specifically needs FIFO compliance or when the tax authority mandates it. Use instead of the net-position endpoint when realized gain per disposal is needed, not just net balance.

## Known failure modes

- Insufficient lot quantity — disposals exceed total acquisition quantities, returning an error or partial match
- Malformed decimal precision — mismatched decimal places between lots causing computation errors
- Missing required fields — acquisition or disposal records lacking timestamps or quantities
- Out-of-order timestamps — lots or disposals with ambiguous or identical timestamps producing non-deterministic FIFO ordering
- Empty lot list — no acquisition records provided, returning zero matches

## How this service works

FIFO cost-basis matching: oldest lots consumed first, with realized gain per disposal in exact decimal math

## Output

Returns a list of disposal events, each showing which acquisition lots were consumed (oldest first), the quantity and cost basis consumed from each lot, the proceeds, and the exact decimal realized gain or loss. Also returns any remaining unconsumed lot balances after matching.

## 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": {
      "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-base-fifo-cost-basis-lot-matching-5c415838/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)
