While using on_data() to receive ticks for a token, I am getting different value for last_traded_price as compared to what is actually going on in the market. While if I am using the ltpData(), it is giving the exact price. Why on_data() is giving some strange price?
For eg-
for a token on_data() is giving last_traded_price': 56430. (56430/100 = 564.30)
{'subscription_mode': 3, 'exchange_type': 2, 'token': '37033', 'sequence_number': 48718658, 'exchange_timestamp': 1717148865000, 'last_traded_price': 56430, 'subscription_mode_val': 'SNAP_QUOTE', 'last_traded_quantity': 25, 'average_traded_price': 51901, 'volume_trade_for_the_day': 3799425, 'total_buy_quantity': 35800.0, 'total_sell_quantity': 32600.0, 'open_price_of_the_day': 53495, 'high_price_of_the_day': 57500, 'low_price_of_the_day': 46500, 'closed_price': 51535, 'last_traded_timestamp': 1717148864, 'open_interest': 238500, 'open_interest_change_percentage': -4605506619295321194, 'upper_circuit_limit': 95090, 'lower_circuit_limit': 20955, '52_week_high_price': 98795, '52_week_low_price': 0, 'best_5_buy_data': [{'flag': 1, 'quantity': 150, 'price': 56460, 'no of orders': 1}, {'flag': 1, 'quantity': 100, 'price': 56455, 'no of orders': 2}, {'flag': 1, 'quantity': 25, 'price': 56450, 'no of orders': 1}, {'flag': 1, 'quantity': 75, 'price': 56445, 'no of orders': 1}, {'flag': 1, 'quantity': 300, 'price': 56440, 'no of orders': 3}], 'best_5_sell_data': [{'flag': 0, 'quantity': 125, 'price': 56575, 'no of orders': 1}, {'flag': 0, 'quantity': 200, 'price': 56580, 'no of orders': 1}, {'flag': 0, 'quantity': 75, 'price': 56585, 'no of orders': 1}, {'flag': 0, 'quantity': 75, 'price': 56590, 'no of orders': 1}, {'flag': 0, 'quantity': 200, 'price': 56595, 'no of orders': 2}], 'datetime': '2024-05-31 15:33:00'}
while smartApi.ltpData("NFO", "", "37033")["data"]["ltp"] is giving 550.0
And this is not only for some ticks, I am observing this problem from few days.