Bid ask that is returned in marketdepth is wrong

hardik__
Hey,

I am trying to get the buy and sell values in market depth but when i do this the data is inconsistent.

For eg. buy should always be less or equal to the ltp but in some cases it is not. Same issue is with sell values.

please let me know i am wrong here.

attaching the data i have received

LTP 12865794 10042.3 BUY 12865794 10041.8 SELL 12865794 10041.85 1 0


LTP 12865794 10041.3 BUY 12865794 10041.65 SELL 12865794 10042 0 1
  • sujith
    sujith edited September 2017
    Hi @hardik__,
    The statement is wrong.
    If the last trade has happened on at 10042.3 then it doesn't mean the next best bid will be lesser than the LTP or next best offer is greater than LTP. It can be anywhere based on what is the price at which next buyer is ready to bid and next seller is ready to offer.
  • sujith
    One condition you can count on is best bid is always lower than best offer.
  • hardik__
    Hey @sujith ,

    So if i retrieve the bid and ask from the same tick data then also what you mentioned above is valid? Also if api provides data for depth size of 5 the one at 0th index will be the best one right?

    Thanks
  • hardik__
    Hey @sujith ,

    Thanks. It seems i was wrong in this case.
  • sujith
    Hi @hardik__,
    Yes, ArrayList in java preserves the order. Hence the first element in the bid ArrayList is the best bid.
Sign In or Register to comment.