# Laevitas Historical Futures Total Open Interest by Margin Type

> Laevitas Historical Futures Total Open Interest by Margin Type is a paid API for AI agents from apiv2.laevitas.ch, paid per call via x402, $0.1/call, status unknown (last checked 2026-11-20).

Returns historical time-series data of total futures open interest broken down by margin type (coin-margined vs USD-margined, dated futures vs perpetuals) for a given cryptocurrency.

## Facts

- Endpoint: POST https://apiv2.laevitas.ch/api/v1/historical/futures/total_oi_by_margin/%7Bcurrency%7D?utm_source=zero.xyz
- Price: $0.1/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/laevitas-historical-futures-total-open-interest-by-margin-type-aa583de8
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_2PyRhwCTGW4fzMAGcRXl_

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 laevitas-historical-futures-total-open-interest-by-margin-type-aa583de8 -d '<json body>'
```

Example prompt: Pull historical total futures open interest for Bitcoin from January 1, 2024 to June 30, 2024, broken down by margin type (coin-margined vs USD-margined, dated futures vs perpetuals), using daily granularity.

## When to prefer this

Choose this endpoint when you need historical time-series open interest data for crypto futures and perpetuals segmented by margin type (coin-margined vs USD-margined). It is ideal for market structure analysis, backtesting, and tracking how collateral composition in derivatives markets has shifted over time. Prefer it over generic OI endpoints when the margin-type breakdown is essential to the analysis.

## Known failure modes

- Missing required 'start' parameter returns 400 error
- Invalid currency symbol returns empty result or 404
- Overly large 'limit' for certain daily series returns 400 POSITIONING_DAILY_PAGE_TOO_LARGE
- Invalid date format returns 400 bad request
- Unauthorized or missing API key / x402 payment returns 401/402
- Requesting data beyond subscription plan date range may return 403 or empty results

## How this service works

Professional market data API for crypto derivatives, spot markets, prediction markets, Hyperliquid HyperCore data, proprietary volatility surfaces, and analytics.

## Authentication

Use an API key for authenticated REST requests:

```http
X-API-Key: your-api-key-here
```

Data and history endpoints also accept x402 without an API key: 1, 5 or 10 credits ($0.001 each) for data up to 1 year, 1–3 years or older.

**Subscriptions with USDC:** Premium and Enterprise can be purchased on Base or Solana for a month, a quarter, six months or a year. Access is prepaid, with no automatic renewal. [Buy a subscription](https://v3.laevitas.ch/profile/subscription/wallet) or read the [USDC subscription guide](/x402#subscriptions).

The subscription belongs to your signed-in Laevitas account; wallet sign-in does not require an email. Enterprise users generate an API key in V3 after activation. Plan and billing-period limits still apply. Subscription purchases are separate from API credit bundles.

For Claude MCP, add `https://apiv2.laevitas.ch/api/v1/mcp`, select **Sign in now → Register automatically**
with no custom headers, and authorize with your API key on the Laevitas page.
Do not enter a client ID or secret manually. All OAuth clients require PKCE S256.
Connection guide: [MCP setup](/mcp). CIMD / published client identity is not supported.

| Resource | Path |
| --- | --- |
| OpenAPI JSON | `GET /openapi.json` |
| x402 discovery | `GET /.well-known/x402` |
| Changelog | `GET /api/v1/changelog` |
| WebSocket docs | `GET /websocket` |

## REST Surfaces

| Surface | Examples |
| --- | --- |
| Instruments | Cross-market contract reference data |
| Futures | OHLCVT, trades, tickers, orderbook, liquidations, carry |
| Perpetuals | OHLCVT, trades, funding, open interest, orderbook, liquidations |
| Options | OHLCVT, trades, Greeks, volatility, flow, dealer GEX |
| Options Backtests | Strategy templates, asynchronous submission, status, combined results, cancellation |
| Vol Surface | Proprietary surface snapshots, slices, strikes, term structure, risk |
| Spot | OHLCVT, ticker, trades, volume, L2 orderbook, snapshots |
| Predictions | Polymarket instruments, categories, trades, ticker history |
| Hyperliquid - HyperCore | Node-derived fills, liquidations, positions, funding, TWAPs, resting orders, L2 books |
| Analytics | Realized volatility and derived metrics |

## Pagination

Backtests are asynchronous jobs, not paginated market-data queries. Start with
`GET /api/v1/options/backtests/strategies`, submit with `POST /api/v1/options/backtests`,
then poll `/{id}` and retrieve `/{id}/result`. These responses have no data/meta wrapper.

Paginated endpoints return the cursor at `meta.next_cursor`. Pass that value back as the `cursor` query parameter to fetch the next page.

## WebSocket Streaming

Real-time streams are documented at `/websocket`.

| Data | Channel pattern |
| --- | --- |
| Trades | `trades.{market}.{exchange}.{instrument}` |
| OHLC ticker | `ohlc.ticker.{market}.{exchange}.{instrument}.{timeframe}` |
| OHLCVT | `ohlc.vt.{market}.{exchange}.{instrument}.{timeframe}` |

Variables: `market` is one of `perpetuals`, `futures`, `options`, or `spot`; `timeframe` is one of `1m`, `5m`, `15m`, `1h`, `4h`, or `1d`.

## Quick Start

```bash
curl "https://apiv2.laevitas.ch/api/v1/futures/ohlcvt?exchange=deribit&instrument_name=BTC-PERPETUAL" \
  -H "X-API-Key: your-api-key-here"
```

## Output

A paginated JSON response containing an array of timestamped records, each with open interest values (in both USD-equivalent and base-asset units) broken down into four categories: dated futures coin-margined, dated futures USD-margined, perpetuals coin-margined, and perpetuals USD-margined. Pagination metadata includes total records, total pages, and items per page.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "start"
 ],
 "properties": {
  "end": {
   "type": "string",
   "description": "Date-only includes the whole UTC day. Omitted end is end of tomorrow UTC."
  },
  "page": {
   "type": "integer",
   "description": "Default query page 1; omitted meta.page matches v1."
  },
  "limit": {
   "type": "integer",
   "description": "Default query 10 rows unless stated otherwise; otherwise omitted meta.total_pages uses divisor 1 as in v1. Max pain counts maturity rows. Daily (1d) options_oi_by_currency, options_volume_by_currency and options_volume_total with exchange=aggregate use at most 2 rows per page, default 2. Larger limits return 400 POSITIONING_DAILY_PAGE_TOO_LARGE. Use limit=2 from page=1 and follow total_pages; the date range and totals are unchanged. Other series and resolutions keep their existing limits."
  },
  "start": {
   "type": "string",
   "description": "Legacy ISO/date-only or 10/13-digit epoch."
  },
  "granularity": {
   "type": "string",
   "description": "UTC sample grid, not interval aggregation; omitted or -- means native."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "meta",
  "items"
 ],
 "properties": {
  "meta": {
   "type": "object",
   "required": [
    "total",
    "items",
    "total_pages"
   ],
   "properties": {
    "page": {
     "type": "integer",
     "maximum": 9007199254740991,
     "minimum": 0,
     "exclusiveMinimum": true
    },
    "items": {
     "type": "integer",
     "maximum": 9007199254740991,
     "minimum": 0
    },
    "total": {
     "type": "integer",
     "maximum": 9007199254740991,
     "minimum": 0
    },
    "total_pages": {
     "type": "integer",
     "maximum": 9007199254740991,
     "minimum": 0
    }
   },
   "additionalProperties": false
  },
  "items": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "date",
     "f_u",
     "f_u_n",
     "f_c",
     "f_c_n",
     "p_u",
     "p_u_n",
     "p_c",
     "p_c_n"
    ],
    "properties": {
     "f_c": {
      "type": "number",
      "nullable": true,
      "description": "Dated futures, coin-margined: open interest in USD-equivalent units."
     },
     "f_u": {
      "type": "number",
      "nullable": true,
      "description": "Dated futures, USD-margined: open interest in USD-equivalent units."
     },
     "p_c": {
      "type": "number",
      "nullable": true,
      "description": "Perpetuals, coin-margined: open interest in USD-equivalent units. c means coin margin, not call."
     },
     "p_u": {
      "type": "number",
      "nullable": true,
      "description": "Perpetuals, USD-margined: open interest in USD-equivalent units. p means perpetual, not put."
     },
     "date": {
      "type": "integer",
      "maximum": 9007199254740991,
      "minimum": 0,
      "description": "Source observation Unix milliseconds, UTC; coarse resolution samples observations rather than summing the interval."
     },
     "f_c_n": {
      "type": "number",
      "nullable": true,
      "description": "Dated futures, coin-margined: open interest in base-asset units."
     },
     "f_u_n": {
      "type": "number",
      "nullable": true,
      "description": "Dated futures, USD-margined: open interest in base-asset units. Legacy _n is NOT USD notional."
     },
     "p_c_n": {
      "type": "number",
      "nullable": true,
      "description": "Perpetuals, coin-margined: open interest in base-asset units."
     },
     "p_u_n": {
      "type": "number",
      "nullable": true,
      "description": "Perpetuals, USD-margined: open interest in base-asset units."
     }

… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/laevitas-historical-futures-total-open-interest-by-margin-type-aa583de8/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from apiv2.laevitas.ch](https://www.zero.xyz/host/apiv2.laevitas.ch/llms.txt)
