Parsing output of onTick

Nikita
Hi Team, I am trying to fetch tick data using websockets in java. For gold future contract, the tick price is published in following manner - [[email protected]]. I am not sure how to read this. Mode used is ltp. Could you please help me in parsing this. Thanks
  • Nikita
    Hi @sujith, could you please reply on this. Let me know if the question is not clear to you. Thanks.
  • sujith
    Hi @Nikita,
    Check out ticker usage example here.


    //Your callback will be some thing like this,

    public void onTick(ArrayList<Tick> ticks) {
    for(int i = 0; i < ticks.size(); i++){
    System.out.println(ticks.get(i).ltp);
    }
    }
  • Nikita
    Thanks Sujith. ltp is not recognised by the code. Getting- ltp cannot be resolved or is not a field. Thanks.
  • sujith
    @Nikita,
    Sorry my bad, variable name in Tick object is lastTradedPrice.
  • Nikita
    resolved now.

    System.out.println(ticks.get(i).getLastTradedPrice());
This discussion has been closed.