# LIFO Cost-Basis Matching for Crypto/Asset Disposals

> LIFO Cost-Basis Matching for Crypto/Asset Disposals 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).

Applies Last-In-First-Out (LIFO) cost-basis matching to a list of acquisition lots and disposal events, returning realized gain/loss per disposal calculated in exact decimal arithmetic.

## Facts

- Endpoint: POST https://evm-canon-base.onrender.com/lots/lifo
- 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/lifo-cost-basis-matching-for-crypto-asset-disposals-d313f130
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_1aV8qanVRhevArxHKMHZO

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 lifo-cost-basis-matching-for-crypto-asset-disposals-d313f130 -d '<json body>'
```

Example prompt: Apply LIFO cost-basis matching to my trade history — I bought 1 ETH at $1800 on Jan 1, 2 ETH at $2200 on Mar 1, then sold 1.5 ETH on Apr 15 — tell me my realized gain or loss using newest lots first, in exact decimal math.

## When to prefer this

Choose this endpoint when you need LIFO (Last-In-First-Out) cost-basis accounting specifically, as required by certain tax jurisdictions or accounting policies. Prefer it over FIFO when the user explicitly requests LIFO, or when tax strategy favors using recently acquired (potentially higher-cost) lots to minimize near-term realized gains. Use instead of the average-cost endpoint when per-lot tracking is required, and instead of HIFO when the newest lots rather than highest-cost lots should be consumed first.

## Known failure modes

- Insufficient lot quantity to cover a disposal — returns an error if disposals exceed total acquired quantity
- Malformed input (missing required lot fields like timestamp, quantity, or cost) — returns a validation error
- Lots with non-parseable decimal values — may return arithmetic errors
- Empty lots array — returns no matches and zero realized gain
- Disposals before any acquisitions chronologically — may yield unexpected results or errors

## How this service works

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

## Output

Returns a list of disposal results where each disposal event is matched against the most recently acquired lots first (LIFO order). Each result includes the specific lots consumed, quantity used from each lot, the cost basis applied, the proceeds, and the realized gain or loss computed in exact decimal arithmetic. Any remaining unconsumed lots are also returned.

## 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/lifo-cost-basis-matching-for-crypto-asset-disposals-d313f130/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)
