Skip to content

SIPL-Dev/dotnetmarketfeedclient

Repository files navigation

ODIN Market Feed .Net library

License: MIT .NET

A robust and efficient .NET Library for connecting to ODIN Market Data Feed via WebSocket with built-in compression support. This Library enables real-time market data streaming for trading applications.

Features

  • Multi-Framework Support: Compatible with .NET 8.0 and .NET Framework 4.8
  • 🚀 Real-time Data: WebSocket-based streaming for low-latency market data
  • 🗜️ Built-in Compression: ZLIB compression support for optimized bandwidth usage
  • 📦 Message Fragmentation: Automatic handling of fragmented messages

Installation

Manual Install

- Download DLL from releases
- Right click on your project » Add » Reference » Click Browse » Select ODINMarketFeed.dll  and VisualJZlibCompression.dll

Quick Start

Basic Usage

using PriceFeedAPI;

// Create client instance
var client = new ODINMarketFeedClient();

// Subscribe to events
client.OnOpen += () => 
{
    Console.WriteLine("Connected to ODIN Market Feed");
};

client.OnMessage += (message) => 
{
    Console.WriteLine($"Received: {message}");
};

client.OnError += (error) => 
{
    Console.WriteLine($"Error: {error}");
};

client.OnClose += (code, reason) => 
{
    Console.WriteLine($"Connection closed: {code} - {reason}");
};

// Connect to the feed
await client.ConnectAsync(
    host: "market-feed.example.com",
    port: 8080,
    useSSL: true,
    userId: "your-user-id",
    apiKey: "your-api-key"
);

// Subscribe to market data
var tokens = new List<string> 
{ 
    "1_2885",  // NSE segment, token 2885
    "1_22"     // NSE segment, token 22
};

await client.SubscribeTouchlineAsync(
    tokenList: tokens,
    responseType: "0",  // 0 = Normal touchline, 1 = Fixed length native data
    LTPChangeOnly: false
);

// Keep the application running
Console.ReadLine();

// Cleanup
await client.DisconnectAsync();
client.Dispose();

Advanced Usage

Pause/Resume Subscription

// Pause the broadcast (e.g., when app is minimized)
await client.SubscribePauseResumeAsync(isPause: true);

// Resume the broadcast
await client.SubscribePauseResumeAsync(isPause: false);

Unsubscribe from Tokens

var tokensToUnsubscribe = new List<string> { "1_2885", "1_22" };
await client.UnSubscribeTouchlineAsync(tokensToUnsubscribe);

Token Format

Tokens follow the format: {MarketSegmentID}_{Token} Please refer api documentation for Market Segment Id

Example:

  • 1_2885 - NSE Cash segment, token 2885
  • 2_12345 - NSE F&O segment, token 12345

Message Format

Please refer api documentation

Sample Projects

Check the samples directory for complete working examples:

  • ConsoleApp - Basic console application demonstrating Library usage

Requirements

  • .NET 8.0 or .NET Framework 4.8 or higher

Troubleshooting

Connection Issues

  1. Verify credentials: Ensure userId and apiKey are correct
  2. Check network: Verify firewall settings allow WebSocket connections
  3. Port accessibility: Ensure the specified port is not blocked #4. SSL certificate: For SSL connections, ensure valid certificates

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

Version 1.0.0

  • Initial release
  • WebSocket connectivity
  • ZLIB compression support

Disclaimer: This Library is provided as-is. Always test thoroughly in a development environment before using in production.

About

ODIN Market Feed Client SDK for C#.NET

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages