How to capture Trade Taken in Terminal using WebSocket

NinganagoudaMB
I want to know, is there a way to capture the trade taken in Kite Terminal using Web Socket.

Example: If I buy bankNifty 44000 call option in Kite Terminal, same should be captured in web socket ticker.

How to get this? Please help me with this. Thanks a lot in advance!
  • rakeshr
    Is there a way to capture the trade taken in Kite Terminal using Web Socket?
    Yes, you can use the order update callback. Go through the java client websocket usage example here.
  • NinganagoudaMB
    I tried by adding token for BankNifty like below: But when I executed a trade in Terminal, it didn't reflect in the orderUpdateBlock:

    ArrayList tokens = new ArrayList();
    tokens.add(26009L);

    KiteTicker tickerProvider = new KiteTicker(kiteConnect.getAccessToken(), kiteConnect.getApiKey());
    tickerProvider.setOnConnectedListener(new OnConnect() {
    @Override
    public void onConnected() {
    /** Subscribe ticks for token.
    * By default, all tokens are subscribed for modeQuote.
    * */
    tickerProvider.subscribe(tokens);
    tickerProvider.setMode(tokens, KiteTicker.modeFull);
    }
    });

    /** Set listener to get order updates.*/
    tickerProvider.setOnOrderUpdateListener(new OnOrderUpdate() {
    @Override
    public void onOrderUpdate(Order order) {
    System.out.println("Yes !!!!!!!! order Details");
    System.out.println("order Id "+order.orderId);
    System.out.println("order filled qty "+order.filledQuantity);
    System.out.println("order qty "+order.quantity);
    System.out.println("order price "+order.price);
    System.out.println("order trading symbol "+order.tradingSymbol);
    }
    });
  • sujith
    You will not get order update for placing an order. It is only sent when there is a partial fill or it is modified or trigger is hit or when it gets executed.
Sign In or Register to comment.