Skip to content

Open Interest

CEX futures Open Interest: latest snapshots, reporting pairs, the token x exchange matrix, top-line aggregates, and aggregated history.

Usage

Sync
from datamaxi import Datamaxi

maxi = Datamaxi(api_key="YOUR_API_KEY")

# Latest OI snapshot for a single futures symbol
snapshot = maxi.open_interest(exchange="binance", symbol="BTC-USDT")

# List all (exchange, symbol) pairs currently reporting OI
pairs = maxi.open_interest.list(exchange="binance")

# Paginated token x exchange OI matrix
overview = maxi.open_interest.overview(
    page=1,
    limit=20,
    key="binance",
    sort="desc",
)

# Top-line OI aggregates (total USD, top tokens, top exchanges)
summary = maxi.open_interest.summary(topN=10)

# Per-exchange aggregated OI history for a single token
history = maxi.open_interest.history_aggregated(
    token_id="bitcoin",
    interval="1h",
)
Async
import asyncio
from datamaxi.aio import AsyncDatamaxi


async def main():
    async with AsyncDatamaxi(api_key="YOUR_API_KEY") as client:
        # Latest OI snapshot for a single futures symbol
        snapshot = await client.open_interest(exchange="binance", symbol="BTC-USDT")

        # List all (exchange, symbol) pairs currently reporting OI
        pairs = await client.open_interest.list(exchange="binance")

        # Paginated token x exchange OI matrix
        overview = await client.open_interest.overview(
            page=1,
            limit=20,
            key="binance",
            sort="desc",
        )

        # Top-line OI aggregates (total USD, top tokens, top exchanges)
        summary = await client.open_interest.summary(topN=10)

        # Per-exchange aggregated OI history for a single token
        history = await client.open_interest.history_aggregated(
            token_id="bitcoin",
            interval="1h",
        )


asyncio.run(main())

Notes

  • overview requires sort to be asc or desc; summary accepts topN between 1 and 30.
  • history_aggregated uses the token id (e.g. bitcoin), not a ticker, and accepts interval of 5m, 15m, 1h, 4h, or 1d. Pass from_ / to as unix-ms (from_ maps to the wire param from).

Bases: Resource

Client to fetch CEX futures Open Interest data from DataMaxi+ API.

Parameters:

  • api_key (str, default: None ) –

    The DataMaxi+ API key

  • **kwargs (Any, default: {} ) –

    Keyword arguments used by datamaxi.api.API.

__call__

__call__(exchange: str, symbol: str) -> Dict[str, Any]

Latest Open Interest snapshot for a single futures symbol.

GET /api/v1/open-interest

Parameters:

  • exchange (str) –

    Exchange (e.g. binance).

  • symbol (str) –

    Exchange-native API symbol (e.g. BTC-USDT).

list

list(exchange: Optional[str] = None) -> Dict[str, Any]

List all (exchange, symbol) pairs currently reporting OI.

GET /api/v1/open-interest/list

Parameters:

  • exchange (str, default: None ) –

    Optional filter to one exchange.

overview

overview(
    page: int = 1,
    limit: int = 20,
    key: str = "binance",
    sort: SortOrder = "desc",
    query: Optional[str] = None,
) -> Dict[str, Any]

Paginated token × exchange OI matrix.

GET /api/v1/open-interest/overview

Parameters:

  • page (int, default: 1 ) –

    Page number.

  • limit (int, default: 20 ) –

    Page size.

  • key (str, default: 'binance' ) –

    Exchange to sort by.

  • sort (str, default: 'desc' ) –

    Sort direction (asc or desc).

  • query (str, default: None ) –

    Optional base-symbol search filter.

summary

summary(topN: int = 10) -> Dict[str, Any]

Top-line OI aggregates (total USD, top tokens, top exchanges).

GET /api/v1/open-interest/summary

Parameters:

  • topN (int, default: 10 ) –

    Top N tokens to return (1-30).

history_aggregated

history_aggregated(
    token_id: str,
    interval: Interval = "1h",
    from_: Optional[int] = None,
    to: Optional[int] = None,
) -> Dict[str, Any]

Per-exchange aggregated OI history for a single token.

GET /api/v1/open-interest/history-aggregated

Parameters:

  • token_id (str) –

    Token id (e.g. bitcoin).

  • interval (str, default: '1h' ) –

    Aggregation interval (5m, 15m, 1h, 4h, or 1d).

  • from_ (int, default: None ) –

    Start unix-ms. Default depends on interval (7d for 1h, 30d for 4h, 1y for 1d).

  • to (int, default: None ) –

    End unix-ms. Defaults to now.

Note

from_ is named with a trailing underscore because from is a Python keyword. The wire-level query param remains from.