Orcpin · Holding Period

by Orcpin

POSTBase

$0.02

per call · USD Coin on Base

Trade-lot holding-period and realized-gain calculator for trading agents: per-lot days held, the exact date each lot's gain character turns long-term, and FIFO / specific-identification allocation of a proposed sell with realized gain per lot and per-character totals. Deterministic arithmetic on caller-supplied lots with the published threshold cited (IRC §1222: held more than one year) — counts, dates, and dollars only, never advice. Nothing is stored.

Endpoint

POST https://orcpin.dev/v1/holding-period

1

Calls / 30d

1

Unique payers / 30d

Aug 17

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://orcpin.dev/v1/holding-period", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "asOf": "2026-07-02",
    "lots": [
      {
        "acquireDate": "2025-01-10",
        "costBasis": 500,
        "quantity": 100,
        "symbol": "XYZ"
      },
      {
        "acquireDate": "2026-06-20",
        "costBasis": 1000,
        "quantity": 100,
        "symbol": "XYZ"
      }
    ],
    "sell": {
      "price": 12,
      "quantity": 150,
      "symbol": "XYZ",
      "tradeDate": "2026-07-02"
    }
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://orcpin.dev/v1/holding-period" \
  -H "Content-Type: application/json" \
  -d '{"asOf":"2026-07-02","lots":[{"acquireDate":"2025-01-10","costBasis":500,"quantity":100,"symbol":"XYZ"},{"acquireDate":"2026-06-20","costBasis":1000,"quantity":100,"symbol":"XYZ"}],"sell":{"price":12,"quantity":150,"symbol":"XYZ","tradeDate":"2026-07-02"}}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "as_of": "2026-07-02",
  "disclaimer": "Deterministic arithmetic on caller-supplied lot data. Informational only — not tax, legal, or investment advice.",
  "explanation": "Selling 150 XYZ on 2026-07-02 (fifo) consumes 2 lots: 100 long-term (realized gain $700.00), 50 short-term (realized gain $100.00). Long-term threshold: held more than one year (IRC §1222).",
  "lots": [
    {
      "acquireDate": "2025-01-10",
      "character": "long_term",
      "daysHeld": 538,
      "daysUntilLongTerm": 0,
      "index": 0,
      "longTermFrom": "2026-01-11",
      "quantity": 100,
      "symbol": "XYZ"
    }
  ],
  "methodology": "https://orcpin.dev/methodology#trade_log",
  "schema_version": "lotmath-v1",
  "sell": {
    "allocations": [
      {
        "character": "long_term",
        "costBasis": 500,
        "daysHeld": 538,
        "lotIndex": 0,
        "proceeds": 1200,
        "quantity": 100,
        "realizedGain": 700
      }
    ],
    "method": "fifo",
    "totals": {
      "long_term": {
        "quantity": 100,
        "realizedGain": 700
      },
      "short_term": {
        "quantity": 50,
        "realizedGain": 100
      }
    }
  },
  "spec": "holding-period"
}

Payment details

Pay to0x8b1cf12e7efe6aea59cd1124ebbe7709e3ac6085
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase
Schemesexact

Is this your API?

Pin it to the top of Market Data and the homepage with a featured placement.

Get featured →

More from Orcpin & similar services