full mode not working

pranksterguru
i am subscribing quote with full mode but when i receive the data, the mode is always quote. i explicitly mentioned that it should be modefull. i've used the same java example that you have in git. you can try using the same




ArrayList tokens = new ArrayList<>();
tokens.add(3076609);
tokens.add(408065);
tokens.add(779521);
KiteTicker tickerProvider = new KiteTicker(kiteconnect);
tickerProvider.setMode(tokens, KiteTicker.modeFull);
tickerProvider.setOnConnectedListener(new OnConnect() {
@Override
public void onConnected() {
try {
/** Subscribe ticks for token.
* By default, all tokens are subscribed for modeQuote.
* */
tickerProvider.subscribe(tokens);
} catch (IOException e) {
e.printStackTrace();
} catch (WebSocketException e) {
e.printStackTrace();
}
}
});
  • sujith
    @pranksterguru,
    You are setting mode before connecting, So it will not work.
    By default, ticker subscribes to quote mode. Hence you are getting quote data.
  • pranksterguru
    it wont work doesnt matter where i give, i changed the mode inside the onconnected block also
    and also after the connect, but it doesnt work. can you please try this code and tell me?




    /** To get live price use com.rainmatter.ticker websocket connection. It is recommended to use only one websocket connection at any point of time and make sure you stop connection, once user goes out of app.*/
    ArrayList tokens = new ArrayList<>();
    tokens.add(3076609);
    tokens.add(408065);
    tokens.add(779521);
    KiteTicker tickerProvider = new KiteTicker(kiteconnect);
    tickerProvider.setOnConnectedListener(new OnConnect() {
    @Override
    public void onConnected() {
    try {
    /** Subscribe ticks for token.
    * By default, all tokens are subscribed for modeQuote.
    * */
    tickerProvider.setMode(tokens, KiteTicker.modeFull);
    tickerProvider.subscribe(tokens);
    } catch (IOException e) {
    e.printStackTrace();
    } catch (WebSocketException e) {
    e.printStackTrace();
    }
    }
    });

    tickerProvider.setOnDisconnectedListener(new OnDisconnect() {
    @Override
    public void onDisconnected() {
    // your code goes here
    }
    });

    tickerProvider.setOnTickerArrivalListener(new OnTick() {
    @Override
    public void onTick(ArrayList ticks) {
    System.out.println(ticks.size());
    if (ticks.size()>0) {
    Tick tk = new Tick();
    tk = ticks.get(1);
    System.out.println( tk.getToken() +" : " + tk.getLastTradedPrice());
    }
    }
    });

    /** connects to com.rainmatter.ticker server for getting live quotes*/
    tickerProvider.connect();

    /** You can check, if websocket connection is open or not using the following method.*/
    boolean isConnected = tickerProvider.isConnectionOpen();
    System.out.println(isConnected);

    /** set mode is used to set mode in which you need tick for list of tokens.
    * Ticker allows three modes, modeFull, modeQuote, modeLTP.
    * For getting only last traded price, use modeLTP
    * For getting last traded price, last traded quantity, average price, volume traded today, total sell quantity and total buy quantity, open, high, low, close, change, use modeQuote
    * For getting all data with depth, use modeFull*/

    tickerProvider.setMode(tokens, KiteTicker.modeFull);
  • sujith
    You need to subscribe for tokens first and then set mode.
  • pranksterguru
    it works when i set the mode right after i subscribe.
    also, i made sure i am not setting mode in more than one place
    thanks
This discussion has been closed.