Skip to main content

Python SDK for OpenInterest Lens — real-time futures market structure API

Project description

OpenInterest Lens SDK

Real-time futures market structure API — OI + COT + term structure as developer-ready signals.

Install

pip install openinterest-lens

For WebSocket streaming support:

pip install openinterest-lens[ws]

Quick Start

from openinterest_lens import OpenInterestLensClient

client = OpenInterestLensClient(
    api_key="oil_sk_live_your_key_here",
    base_url="https://api.openinterestlens.com"  # or http://localhost:8000 for local
)

# Get positioning signals for S&P 500 E-mini
signal = client.get_signals("ES")
print(f"Smart Money Direction: {signal.data.direction}")
print(f"Conviction: {signal.data.conviction}")

# Get term structure
ts = client.get_term_structure("ES")

# Get COT data
cot = client.get_cot("ES")

# List available contracts
contracts = client.get_contracts()

client.close()

Async Client

import asyncio
from openinterest_lens import AsyncOpenInterestLensClient

async def main():
    async with AsyncOpenInterestLensClient(api_key="...") as client:
        signal = await client.get_signals("ES")
        print(signal.data.direction)

asyncio.run(main())

Builder Pattern

from openinterest_lens import ClientBuilder

client = (
    ClientBuilder()
    .base_url("https://api.openinterestlens.com")
    .api_key("oil_sk_live_...")
    .timeout(60)
    .max_retries(5)
    .build()
)

WebSocket Streaming

import asyncio
from openinterest_lens import AsyncSignalStream

async def stream():
    stream = AsyncSignalStream(
        api_key="oil_sk_live_...",
        contracts=["ES", "NQ", "CL"],
    )
    async for event in stream:
        print(f"{event['contract']}: {event['signal']['direction']}")

asyncio.run(stream())

API Endpoints

Endpoint Description
GET /v1/contracts List available contracts
GET /v1/signals/{symbol} Get positioning signals
GET /v1/term-structure/{symbol} Get term structure curves
GET /v1/roll-pressure/{symbol} Get roll pressure index
GET /v1/cot/{symbol} Get COT report data
GET /v1/health Health check
GET /v1/quality Data quality metrics
WS /ws/v1/signals Real-time signal streaming

Tiers

Feature Free Pro ($49/mo) Enterprise
Requests/day 100 10,000 Unlimited
Contracts 5 All All
Historical data 30 days 1 year Full
WebSocket
Support Community Email Slack

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openinterest_lens-0.1.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openinterest_lens-0.1.0-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file openinterest_lens-0.1.0.tar.gz.

File metadata

  • Download URL: openinterest_lens-0.1.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for openinterest_lens-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ccfb600f943a40c6b1bc07027c291ab720da25441716e9b3b98b0171b0000c87
MD5 38e305688c58d7d0eab5fc2acd2593a7
BLAKE2b-256 cd3b61891b44ce58908a04f52860227f9ea2d519a48dc037e08c6ae2aadd5d68

See more details on using hashes here.

File details

Details for the file openinterest_lens-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openinterest_lens-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ffc6ae54565894220e2e8563b85ff0403c7ca114ace852a6f80a3dc2bc3c083
MD5 9c98cfcda5275f898994348f466030f4
BLAKE2b-256 e20c8d6d1a74552dfce2b827fd392946cc13e7c205c38a4b005bccf3569a5af0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page