Need assistance on web Socket call
-
Hello @admin
Yesterday onwards websocket.tickerUsage() stopped working, I request you to share any references for the same using java.
Any help is appreciated!String strWatchListScript = "mcx_fo|243301";
String task = "sfi";
examples.tickerUsage(clientID, feedToken, strWatchListScript, task);Sample Response :
subscribe() called!
ticker data: [{"msg":"cn","task":"cn","ak":"nk"}]
ticker data: [{"msg":"bh","task":"bh","ak":"nk"}]
ticker data: [{"msg":"hb","task":"hb","ak":"nk"}]Thanks
-
@admin This is really awesome! Saves lot of time.
Just one difference I found. The prices received are multiplied by 100 and user has to divide it by 100 to get right price.Is it correct implementation or some bug.
I dont understand the reason to do so.@Override
public void onQuoteArrival(Quote quote) {
ZonedDateTime exchangeTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(quote.getExchangeFeedTimeEpochMillis()), TZ_IST);
String data = String.format("token: %s"
+ " sequenceNumber: %d"
+ " ltp: %.2f"
+ " open: %.2f"
+ " high: %.2f"
+ " low: %.2f"
+ " close: %.2f"
+ " exchangeTime: %s"
+ " exchangeToClientLatency: %s",
quote.getToken().toString(),
quote.getSequenceNumber(),
(quote.getLastTradedPrice() / 100.0),
(quote.getOpenPrice() / 100.0),
(quote.getHighPrice() / 100.0),
(quote.getLowPrice() / 100.0),
(quote.getClosePrice() / 100.0),
exchangeTime,
Instant.now().toEpochMilli() - quote.getExchangeFeedTimeEpochMillis());
System.out.println(data);
} -
@admin Thank you
-
HI @AravindAnbalagan @techsharad @Ashok
I wanted to share an example code in Java for working with Websocket 2.0 and the SmartStreamTicker class. This code can be used as a reference only and is not an official release. You can find the code on GitHub at https://github.com/angel-one/smartapi-java/pull/1/files
Please note that this code is provided as a sample only and is not an official release. It is not officially supported and should be used with caution.
This is just to give you an idea of the best practices for running a websocket, including parsing logic, and can be used as a reference only
Please let me know if you have any questions or concerns.
-
@techsharad websocket is migrated to new endpoint. unfortunately no wrapper available for that in java. only python was released by AB.
-
@AravindAnbalagan yes it not working, and can't find any solution yet.