Incorrect historical data for last candle interval

Incorrect high and close values are populated from API call for last time candle.

Consider a 5 minute interval, fetching intraday data. The latest time data is always incorrect OHLC values.

Eg: Api output: called at 14:55:10, so the latest historical data is 2025-04-07 14:55:00
Api output:
2025-04-07 14:45:00 49526.000000 49563.50 49507.25 49535.05 0.0
2025-04-07 14:50:00 49521.000000 49578.60 49503.05 49521.50 0.0
2025-04-07 14:55:00 49521.250000 49534.15 49521.25 49534.15 0.0
Actual value from chart:
2025-04-07 14:55:00 49521.250000 49634.40 49521.25 49576.40

You can see the High and close value has massive difference. High (from api call 49534.15 and from chart 49634.40) , Close value (from api call 49534.15 and from chart 49576.40 )

This is giving incorrect values impacting to proceed further to get actual historical data.

Can this be addressed please.
cc @Hardik

Hello @shb0390

Can you please share the instrument for which you faced this issue. This shouldn’t be the scenario as post close of candle, the data should be the same as plotted on chart, as the source of both the chart remains the same.

Hi @Hardik

This is for bank nifty. Below details used in code

{‘securityId’: ‘25’, ‘exchangeSegment’: ‘IDX_I’, ‘instrument’: ‘INDEX’, ‘interval’: ‘5’, ‘fromDate’: ‘2025-04-08’, ‘toDate’: ‘2025-04-08’}
URL : “https://api.dhan.co/v2/charts/intraday

Today’s data again:
From API call:
2025-04-08 14:35:00 50553.250000 50563.600000 50445.600000 50461.10 0.0 (matched with chart)
2025-04-08 14:40:00 50462.100000 50475.650000 50449.150000 50473.40 0.0
From chart:
2025-04-08 14:35:00 50553.25 50563.60 50445.60 50461.10

Did some analysis, suppose if I hit API after every 5 minutes, lets say here 14:40:10, the historical data returns 14:40:00 candles data also which is the running candle and its not closed yet and after 14:45 we get the correct data after its completion. Hence is the confusion. Is my understanding correct?