Need help in getting proper 1min ohlc data through websocket

Hi,
I am able to setup websocket connection and recieve the data. But I am not recieving proper ohlc data sometimes.
I am trying to get previous min data after 2secs after each minute(12.01.02 or 12.02.02 etc). But sometimes I am not getting proper data, the timestamp is not what is expected.
Eg. when I recieve data at 12.02.02, I am expecting my_dict[‘feeds’][symbol][‘ff’][‘marketFF’][‘marketOHLC’][‘ohlc’][1][‘ts’] should be 12.01.00. But occasionally it is 12.00.00.
Can you please provide me any python code if available to get the previous min I1(1minute) ohlc data through websocket.
Thanks,
Shiva

Websocket will stream live data and not any history of data. if you are looking to create candlestick based on websocket data, you will need to store data and do the processing.
I think you can use intraday candle api to get full day 1 min candle.

Yes, but it will provide the previous 1 min candle data right, with “mode”: “full”. I am trying to use that rather than processing the ltp to create 1min candle.
In that only I am facing issue.

websocket will not provide last 1 min candle. I would suggest you to use Intraday Candle Data api (Intraday Candle Data | Upstox Developer API) if you need 1 min candlestick data. This API provides data of 1 min candle starting 9.15. this should help with your use case i guess.

According to this we can get 1min candle.
NOTE
For the 1d interval, a single candle representing the previous day is returned. In the case of I1 and I30 intervals, two candles, one for the current and the one preceding it are provided.
@Pradeep_Jaiswar can you please help.

@Shiva_Kumar You are correct, the websocket will provide you with one previous candle for 1-minute and 30-minute intervals.

You can try our new Python code on GitHub: GitHub - upstox/upstox-python: Official Python SDK for accessing Upstox API. Refer to the sample code in the readme file for guidance.

If you could share a sample code you’re working with, we’d be happy to review it.

Hi @Pradeep_Jaiswar

I am able to setup and get the data, but my problem is that sometimes I am getting wrong data. As i explained initially.

Is there a way i can solve that issue?

Thanks,
Shiva