A Java WebSocket client library for connecting to ODIN Market Feed with built-in support for compression, fragmentation, and real-time market data streaming.
- 🚀 WebSocket-based real-time market data streaming
- 🗜️ Built-in ZLIB compression/decompression
- 📦 Automatic message fragmentation and defragmentation
- 🔄 Subscribe/Unsubscribe to market data feeds
- ⏸️ Pause/Resume subscription support
- 🔌 Connection management with auto-reconnect capabilities
- 📊 Support for LTP (Last Traded Price) and Touchline data
- Java 11 or higher
- Maven 3.6 or higher
Add this dependency to your pom.xml:
<dependency>
<groupId>com.trading</groupId>
<artifactId>odin-market-feed-client</artifactId>
<version>1.0.0</version>
<scope>system</scope>
</dependency>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.5.3</version>
</dependency>Add this to your build.gradle:
implementation 'com.trading:odin-market-feed-client:1.0.0'git clone https://github.com/SIPL-Dev/java-odinmarketfeedclient.git
cd odin-market-feed-client
mvn clean installimport com.trading.ODINMarketFeedClient;
import java.util.Arrays;
import java.util.List;
public class Example {
public static void main(String[] args) {
// Create client instance
ODINMarketFeedClient client = new ODINMarketFeedClient();
// Set callbacks
client.setOnConnectCallback(() -> {
System.out.println("Connected to market feed!");
});
client.setOnMessageCallback((message) -> {
System.out.println("Received: " + message);
});
client.setOnErrorCallback((error) -> {
System.err.println("Error: " + error);
});
client.setOnDisconnectCallback(() -> {
System.out.println("Disconnected from market feed");
});
// Connect to the server
String wsUrl = "wss://your-market-feed-url.com";
client.connect(wsUrl);
// Wait for connection
Thread.sleep(2000);
// Subscribe to tokens
List<String> tokens = Arrays.asList("1_26000", "1_26009");
client.subscribeLTPTouchline(tokens);
}
}The client uses CompletableFuture for asynchronous operations. Ensure proper synchronization when accessing shared resources from callbacks.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues, questions, or contributions, please open an issue on GitHub.
- Initial release
- WebSocket connection management
- LTP Touchline subscription support
- Compression and fragmentation handling
- Pause/Resume functionality
- Built with Java-WebSocket library
- Uses ZLIB compression for efficient data transfer