logo

Tracking Open Interest (OI) Programmatically with the HDFC SKY Open API

By HDFC SKY | Published at: Nov 5, 2026 04:58 PM IST

Tracking Open Interest (OI) Programmatically with the HDFC SKY Open API

Open Free Demat Account

By signing up I certify terms, conditions & privacy policy

Open Interest (OI) is one of the most important indicators in the derivatives market. It helps traders understand how many futures and options (F&O) contracts remain active at any given time. Tracking OI programmatically allows developers to monitor market activity in real time and build data-driven trading applications.

The HDFC SKY Open API provides WebSocket support for streaming live market data. Once a WebSocket connection is established, market updates are delivered continuously without repeatedly requesting data through separate HTTP calls. This guide explains how to get started, track OI, and use the data effectively.

What Is Open Interest (OI)?

Open Interest (OI) is the total number of outstanding futures or options contracts that are currently open and have not been settled or closed. Unlike trading volume, which shows the number of contracts traded during a session, OI reflects the total number of active contracts in the market.

For example, if two traders create a new futures contract, the Open Interest increases. If they later close that contract, the Open Interest decreases. Tracking OI over time helps traders understand changes in market participation and activity.

Why Open Interest Matters

Open Interest can provide valuable insights into derivatives trading. Some common uses include:

  • Monitoring market participation
  • Tracking fresh positions in futures and options
  • Analysing Open Interest to identify potential long build-up, short build-up, long unwinding, and short covering
  • Detecting long unwinding and short covering
  • Supporting technical and derivatives analysis
  • Building trading dashboards
  • Analysing market activity over time

Open Interest should always be analysed alongside price and trading volume for a more complete view of market behaviour.

How the HDFC SKY Open API Helps Track Open Interest

The HDFC SKY Open API provides access to live market data through WebSockets. Instead of repeatedly sending API requests, a WebSocket connection continuously streams market updates as they occur.

This approach reduces latency and allows applications to receive tick-by-tick updates for subscribed instruments.

Understanding WebSockets

A WebSocket creates a continuous connection between your application and the HDFC SKY market data server.

Once the connection is established, market updates are delivered automatically whenever new data becomes available. This makes WebSockets suitable for applications that require real-time monitoring of derivatives data, including Open Interest.

Also Read: Historical Candle Data-Intervals and Limits in HDFC SKY Open API

Steps to Track Open Interest Programmatically

Tracking OI involves a few simple steps.

  1. Establish a WebSocket Connection
    Connect your application to the HDFC SKY WebSocket service using the authentication process described in the developer documentation.
    Once connected, your application can receive continuous market updates.
  2. Subscribe to Derivative Instruments
    After establishing the connection, subscribe to the derivative contracts that you want to monitor.
    Subscriptions are typically made using the instrument or token IDs for supported contracts, such as NSE Futures & Options (NSE FO) or MCX commodity derivatives.
    Only the subscribed instruments will stream live market data.
  3. Parse the Incoming Market Data
    Each market update contains information about the subscribed instrument. The streamed market data contains information for the subscribed derivative instruments. Depending on the API response, developers can extract fields such as Open Interest, change in Open Interest, and trading volume.
    The exact response structure and available fields are described in the HDFC SKY Developer Portal documentation. The extracted data can then be processed or stored for further analysis within the application.
  4. Store the Data
    Applications often store streaming data for future analysis.
    Developers can store the received market data in a database that best suits their application. Common choices include:
    I. SQLite
    II. InfluxDB
    III. PostgreSQL
    IV. MySQL
    The choice of database depends on the size, performance, and analytical requirements of the application. Storing historical Open Interest data helps developers analyse market activity over different trading sessions.
  5. Analyse Open Interest Trends
    Once the data is stored, it can be analysed to identify changes in market activity.

Developers may build charts, dashboards, or alerts to monitor Open Interest alongside price and trading volume.

Understanding Common Open Interest Scenarios

Market participants often analyse Open Interest together with price movements to better understand changes in derivatives market activity. The following interpretations are commonly used in market analysis. However, they should be considered analytical observations rather than confirmed trading signals.

  1. Long Build-up: Price rises while Open Interest also increases. This may indicate that new long positions are being created.
  2. Short Build-up: Price falls while Open Interest increases. This may indicate that traders are creating new short positions.
  3. Long Unwinding: Price falls while Open Interest decreases. This may indicate that existing long positions are being closed.
  4. Short Covering: Price rises while Open Interest decreases. This may indicate that traders are closing their short positions.

These scenarios are widely used in derivatives analysis. However, they should not be interpreted as trading signals on their own.

Best Practices for Tracking Open Interest

Following a few good practices can improve the reliability of your application.

  1. Maintain a Stable WebSocket Connection
    Monitor the connection and reconnect automatically if it is interrupted.
  2. Validate Incoming Data
    Check incoming messages before processing them to avoid errors caused by incomplete or invalid data.
  3. Store Historical Data
    Saving historical OI data helps analyse trends over longer periods.
  4. Monitor Multiple Indicators
    Analyse Open Interest together with price, trading volume, and other relevant market indicators instead of relying on a single metric. Combining multiple indicators provides a more balanced view of market activity.
  5. Follow the Official Documentation
    Refer to the HDFC SKY Developer Portal for the latest information on authentication, supported APIs, WebSocket implementation, and response formats, as these may change over time.

Common Applications of Programmatic Open Interest Tracking

Programmatic OI tracking supports many financial applications.

Some common use cases include:

  • Real-time trading dashboards
  • Algorithmic trading systems
  • Futures and options analytics
  • Market monitoring tools
  • Research platforms
  • Risk management systems
  • Educational trading applications

Developers can combine Open Interest with other market data to build more comprehensive analytical tools.

Conclusion

The HDFC SKY Open API makes it easier to track Open Interest programmatically through real-time APIs and WebSocket streaming. By establishing a secure connection, subscribing to derivative instruments, and processing live market data, developers can build applications that monitor market activity efficiently. Always refer to the HDFC SKY Developer Portal for the latest API documentation and implementation guidelines before integrating your application.

Summarize with AI
Google GeminiChatGPTPerplexity AIAnthropic AIGrok AI

Open Free Demat Account

By signing up I certify terms, conditions & privacy policy

Desktop BannerMobile Banner

Invest Anytime, Anywhere

Get it on Google PlayGet it on App Store

Open Free Demat Account Online

By signing up I certify terms, conditions & privacy policy