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.
- ✅ 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
- Download DLL from releases
- Right click on your project » Add » Reference » Click Browse » Select ODINMarketFeed.dll and VisualJZlibCompression.dllusing 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();// Pause the broadcast (e.g., when app is minimized)
await client.SubscribePauseResumeAsync(isPause: true);
// Resume the broadcast
await client.SubscribePauseResumeAsync(isPause: false);var tokensToUnsubscribe = new List<string> { "1_2885", "1_22" };
await client.UnSubscribeTouchlineAsync(tokensToUnsubscribe);Tokens follow the format: {MarketSegmentID}_{Token}
Please refer api documentation for Market Segment Id
Example:
1_2885- NSE Cash segment, token 28852_12345- NSE F&O segment, token 12345
Please refer api documentation
Check the samples directory for complete working examples:
- ConsoleApp - Basic console application demonstrating Library usage
- .NET 8.0 or .NET Framework 4.8 or higher
- Verify credentials: Ensure userId and apiKey are correct
- Check network: Verify firewall settings allow WebSocket connections
- Port accessibility: Ensure the specified port is not blocked #4. SSL certificate: For SSL connections, ensure valid certificates
This project is licensed under the MIT License - see the LICENSE file for details.
- 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.