In the first tick received, the high is same as last price, which indicates a new high pertaining to the price change, In the third tick, the high changed to 728.15, but there is no last price with the 728.15, why?
It is because Kite Connect provides only level 2 data, it is a SNAPSHOT data as published by the exchange. There can be hundreds of ticks per second at the exchange. But exchange streams only one or two ticks in a second on the internet. For tick by tick data, you need to be colocated at the exchange.
is the data same? because your charts have the high and lows in the candles that doesn't reflect in the last_price of ticks through websocket api's , if the data is same, then provide me with the logic of candle creation
is the data same? because your charts have the high and lows in the candles that doesn't reflect in the last_price of ticks through websocket api's
Yes, the data source is the same. We also consider high and low from the OHLC field for candle formation in charts. If there are changes in the high/low values in OHLC, it means these price movements occurred during that period.
datetime:2025-01-16 09:15:00.916592+05:30 Received ticks: [{'tradable': True, 'mode': 'quote', 'instrument_token': 10109954, 'last_price': 668.95, 'last_traded_quantity': 15, 'average_traded_price': 702.32, 'volume_traded': 90, 'total_buy_quantity': 4515, 'total_sell_quantity': 7755, 'ohlc': {'open': 596.0, 'high': 780.0, 'low': 596.0, 'close': 531.8}, 'change': 25.789770590447556}] datetime:2025-01-16 09:15:01.816762+05:30 Received ticks: [{'tradable': True, 'mode': 'quote', 'instrument_token': 10109954, 'last_price': 668.95, 'last_traded_quantity': 15, 'average_traded_price': 702.32, 'volume_traded': 90, 'total_buy_quantity': 4515, 'total_sell_quantity': 7755, 'ohlc': {'open': 596.0, 'high': 780.0, 'low': 596.0, 'close': 531.8}, 'change': 25.789770590447556}] datetime:2025-01-16 09:15:02.416658+05:30 Received ticks: [{'tradable': True, 'mode': 'quote', 'instrument_token': 10109954, 'last_price': 688.85, 'last_traded_quantity': 15, 'average_traded_price': 675.73, 'volume_traded': 1125, 'total_buy_quantity': 8505, 'total_sell_quantity': 15870, 'ohlc': {'open': 596.0, 'high': 780.0, 'low': 596.0, 'close': 531.8}, 'change': 29.531778864234692}] One More Example There appears to be a discrepancy between the OHLC data (Open, High, Low, Close) and the ticks received for the instrument `10109954`. The OHLC data consistently indicates a high of 780.0 for the 9:15 candle, suggesting that the price reached 780.0 during the candle's timeframe. However, no tick received after 9:15 shows a `last_price` of 780.0. The `last_price` in the ticks starts at 668.95 (recorded at `2025-01-16 09:15:00.916592`) and subsequently changes to 688.85 (recorded at `2025-01-16 09:15:02`). This indicates that while the OHLC high reflects a price of 780.0, none of the ticks received during this period captured this price. The first tick was received at `2025-01-16 09:15:00.916592`, which could imply that the high of 780.0 occurred before the ticks were captured or that the granularity of the tick data missed this price point.
Scenario: I start making OHLC (Open, High, Low, Close) candles at 9:15 AM. However, the first tick I receive has a high of 780. I cannot determine if this is:
The actual high of the day so far, or A high reached within the level 2 snapshot,
How can I resolve this issue to ensure my candle calculations are accurate, especially for the initial period?
There can be hundreds of ticks per second at the exchange. But exchange streams only one or two ticks in a second on the internet. For tick by tick data, you need to be colocated at the exchange.
datetime:2025-01-16 09:15:01.816762+05:30 Received ticks: [{'tradable': True, 'mode': 'quote', 'instrument_token': 10109954, 'last_price': 668.95, 'last_traded_quantity': 15, 'average_traded_price': 702.32, 'volume_traded': 90, 'total_buy_quantity': 4515, 'total_sell_quantity': 7755, 'ohlc': {'open': 596.0, 'high': 780.0, 'low': 596.0, 'close': 531.8}, 'change': 25.789770590447556}]
datetime:2025-01-16 09:15:02.416658+05:30 Received ticks: [{'tradable': True, 'mode': 'quote', 'instrument_token': 10109954, 'last_price': 688.85, 'last_traded_quantity': 15, 'average_traded_price': 675.73, 'volume_traded': 1125, 'total_buy_quantity': 8505, 'total_sell_quantity': 15870, 'ohlc': {'open': 596.0, 'high': 780.0, 'low': 596.0, 'close': 531.8}, 'change': 29.531778864234692}]
One More Example
There appears to be a discrepancy between the OHLC data (Open, High, Low, Close) and the ticks received for the instrument `10109954`. The OHLC data consistently indicates a high of 780.0 for the 9:15 candle, suggesting that the price reached 780.0 during the candle's timeframe. However, no tick received after 9:15 shows a `last_price` of 780.0. The `last_price` in the ticks starts at 668.95 (recorded at `2025-01-16 09:15:00.916592`) and subsequently changes to 688.85 (recorded at `2025-01-16 09:15:02`). This indicates that while the OHLC high reflects a price of 780.0, none of the ticks received during this period captured this price. The first tick was received at `2025-01-16 09:15:00.916592`, which could imply that the high of 780.0 occurred before the ticks were captured or that the granularity of the tick data missed this price point.
I start making OHLC (Open, High, Low, Close) candles at 9:15 AM. However, the first tick I receive has a high of 780. I cannot determine if this is:
The actual high of the day so far, or
A high reached within the level 2 snapshot,
How can I resolve this issue to ensure my candle calculations are accurate, especially for the initial period?