problem of duplicate candles in historical Data API

My code was throwing this error, {ValueError}ValueError('cannot reindex on an axis with duplicate labels') and when i started to look into it, i found that Fyers is sending a duplicate candle of the last candle as shown below.

[1698796800, 131.25, 137, 129.5, 132, 51255],
[1698883200, 130.05, 133.8, 128.85, 129.85, 22181],
[1698969600, 132.5, 133.75, 128.4, 128.65, 30408],
[1698969600, 132.5, 133.75, 128.4, 128.65, 30408]]

API was called using the following parameters.

{'cont_flag': '1', 'date_format': '1', 'range_from': '2023-09-05', 'range_to': '2023-11-05', 'resolution': 'D', 'symbol': 'NSE:EMAMIPAP-EQ'}

This is problematic as we are not getting the correct number of candles for the specified range of dates.

Kindly rectify this as soon as possible.

many such anomalies are there. You have to encounter them and write rules to cleanup data and then use it.

Dont rely blindly on any source.

Hi @s13rw81 ,

I checked from my side with the same parameter, I am not getting the same candle.
Please confirm are you sending just one request or multiple requests with different dates to get data?

@ZppA1qLXjC these “bad ticks” are not consistent, but they do happen. occassionally if i do backfill(history api request for the day) post 1530H, there are random ticks sent with timestamps from 1531H to 1540H for NSE index/NSE stocks. (and yes, these are not post-closing session ticks, usually those prices have to be weighted close and post session is not even started at that time)

Earlier issue was sorted where entire history data of quote api was sent twice (double duplicate of all candles)

As i wrote, i have written filters to consume raw data

Thank you for looking into this. I have checked just now, the issue is not happening anymore. I will let you know if this happens again.

Thank you.

[1700784000, 28.35, 28.75, 25.35, 26.05, 469768], [1701129600, 27, 28.65, 26.6, 28.2, 627460], [1701216000, 27.75, 28.65, 27.7, 27.9, 300419], [1701302400, 28.5, 29.05, 27.95, 28.9, 474200], [1701388800, 28.9, 28.95, 28, 28.15, 184362], [1701388800, 28.9, 28.95, 28, 28.15, 184362]], 'code': 200, 'message': '', 's': 'ok'} the issue persists. there are multiple symbols giving duplicate rows at the end. can you check now ?

Hi @s13rw81

Can you share the payload so that I can check

I am also getting duplicate data for last candle. I don’t want to manually handle this issue. Can someone from Fyers team look into it?

Hi
Can you share your payload