Capture last traded price when there is any change in last traded price ONLY

jkoracle23 edited February 2019 in Java client
My requirement is that I need to collect last traded price only when it changes.
I used ticker below but it tick.size>0 happens for other parameters as well like (
) etc

Is there any way where I will get notification ONLY when last traded price changes and not because of other items change??
tickerProvider.setOnTickerArrivalListener(new OnTicks() {
public void onTicks(ArrayList<Tick> ticks) {
NumberFormat formatter = new DecimalFormat();
System.out.println("ticks size "+ticks.size());
if(ticks.size() > 0) {
System.out.println("last price "+ticks.get(0).getLastTradedPrice());
System.out.println("open interest "+formatter.format(ticks.get(0).getOi()));
System.out.println("day high OI "+formatter.format(ticks.get(0).getOpenInterestDayHigh()));
System.out.println("day low OI "+formatter.format(ticks.get(0).getOpenInterestDayLow()));
System.out.println("change "+formatter.format(ticks.get(0).getChange()));
System.out.println("tick timestamp "+ticks.get(0).getTickTimestamp());
System.out.println("tick timestamp date "+ticks.get(0).getTickTimestamp());
System.out.println("last traded time "+ticks.get(0).getLastTradedTime());
  • jkoracle23
    @sujith -Would be greatful if you could suggest any solution.
  • rakeshr
    You can try storing previous ltp in local variable and then use condition to alert, if current feed last traded price is not equal to previous stored ltp, in the same loop you can keep swapping ltp local variable with the latest one.
  • sujith
    You may try setting mode to modeLTP.
  • sujith
    You will receive ticks only when there is an ltp change.
  • algobulls
    Dear sir

    We can help you out with your above query, It is very much possible in our platform with more customizable options

    Kindly contact: [email protected]
    Call : +91 8291474939/ +91 8879647666
    Website :

    Dear sir

    We can help you out with the Automatic Algorithm software with more customizable options also access set your own strategy and of our clients who are ready to share there strategy

    Kindly contact: [email protected]

    Call : +91 8291474939/ +91 8879647666
    Website :
  • jkoracle23
    Please close this thread . As suggested by Sujith , I used previous ltp for comparison.
This discussion has been closed.