# Mismatch between OHLC data from API and Live charts ate web terminal

**URL:** <https://community.delta.exchange/t/mismatch-between-ohlc-data-from-api-and-live-charts-ate-web-terminal/2237>\
**Category:** APIs & Algo Trading\
**Created:** [December 26, 2025, 5:17am UTC](https://community.delta.exchange/t/mismatch-between-ohlc-data-from-api-and-live-charts-ate-web-terminal/2237 "2025-12-26T05:17:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raag-19](https://avatars.discourse-cdn.com/v4/letter/r/96bed5/32.png) [@Raag-19](https://community.delta.exchange/u/Raag-19)\
**Post date:** [December 26, 2025, 5:17am UTC](https://community.delta.exchange/t/mismatch-between-ohlc-data-from-api-and-live-charts-ate-web-terminal/2237/1 "2025-12-26T05:17:18Z")

</div>

```python
import requests
import time
import datetime
from datetime import datetime, timedelta, timezone

headers = {
  'Accept': 'application/json'
}
for i in range (10):
    # Get current UTC time
    now_utc = datetime.now(timezone.utc)

    # Calculate seconds until the next minute boundary for accurate sleep
    seconds_until_next_candle = (60) - (now_utc.timestamp() % (60))

    # Calculate start and end timestamps (UTC) for the API request to get the last COMPLETED 1-minute candle.
    current_minute_start_dt = now_utc.replace(second=0, microsecond=0)
    end_time_ts = current_minute_start_dt.timestamp() # End of the window (exclusive) will be start of current minute
    start_time_ts = (current_minute_start_dt - timedelta(minutes=2)).timestamp() # Start of the window (inclusive)

    print (f"Requesting from {datetime.fromtimestamp(start_time_ts, tz=timezone.utc)} to {datetime.fromtimestamp(end_time_ts, tz=timezone.utc)}")
    print (f"Start Timestamp: {start_time_ts}")
    print (f"End Timestamp: {end_time_ts}")

    r = requests.get('https://api.india.delta.exchange/v2/history/candles', params={
  'resolution': '1m', 'symbol': 'ETHUSD', 'start' : start_time_ts, 'end' : end_time_ts
}, headers = headers)

    response_json = r.json()
    if response_json and response_json.get('result'):
        print(f"Successfully fetched {len(response_json['result'])} candlesticks.")
        # Print the last available candle, which should be the last completed 1-minute candle
        print(f"Last Candle: {response_json['result'][-1]}")
    else:
        print("No candlesticks data found for the given parameters, or response is empty.")
        print(f"API Response: {response_json}")

    time.sleep(seconds_until_next_candle)
    time.sleep(2)

```

this is my code and it is getting few points mismatch mostly in close and open of candlesticks.  
what are the ways to resolve it . as it will affect the calculation of supertrend and other indicators leading to wrong entry and exits.

---

<div class="post-metadata">

**Author:** ![Raag-19](https://avatars.discourse-cdn.com/v4/letter/r/96bed5/32.png) [@Raag-19](https://community.delta.exchange/u/Raag-19)\
**Post date:** [December 26, 2025, 5:18am UTC](https://community.delta.exchange/t/mismatch-between-ohlc-data-from-api-and-live-charts-ate-web-terminal/2237/2 "2025-12-26T05:18:44Z")

</div>

![Screenshot 2025-12-25 191649](https://canada1.discourse-cdn.com/flex004/uploads/deltaexchange/original/1X/4067740c2f5515fb3e31e73395faaba4d943a5c1.png)

---

<div class="post-metadata">

**Author:** ![Raag-19](https://avatars.discourse-cdn.com/v4/letter/r/96bed5/32.png) [@Raag-19](https://community.delta.exchange/u/Raag-19)\
**Post date:** [December 26, 2025, 5:20am UTC](https://community.delta.exchange/t/mismatch-between-ohlc-data-from-api-and-live-charts-ate-web-terminal/2237/3 "2025-12-26T05:20:11Z")

</div>

![Screenshot 2025-12-25 191734](https://canada1.discourse-cdn.com/flex004/uploads/deltaexchange/original/1X/3864389617da89c3caf5a7952ecce8be19ff3d16.png)close is differed by 0.1

---

<div class="post-metadata">

**Author:** ![Raag-19](https://avatars.discourse-cdn.com/v4/letter/r/96bed5/32.png) [@Raag-19](https://community.delta.exchange/u/Raag-19)\
**Post date:** [December 26, 2025, 5:20am UTC](https://community.delta.exchange/t/mismatch-between-ohlc-data-from-api-and-live-charts-ate-web-terminal/2237/4 "2025-12-26T05:20:49Z")

</div>

similarly for many candles

---

<div class="post-metadata">

**Author:** ![manku.pathak](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@manku.pathak](https://community.delta.exchange/u/manku.pathak)\
**Post date:** [December 29, 2025, 5:53am UTC](https://community.delta.exchange/t/mismatch-between-ohlc-data-from-api-and-live-charts-ate-web-terminal/2237/6 "2025-12-29T05:53:07Z")

</div>

The latest candle you’re seeing is the _current, still-forming_ candle and is updated frequently. Because it hasn’t closed yet, only the **open** price is final—values like **high, low, and close** will keep changing and may not match.  
Websocket channel: [Delta Exchange Api](https://docs.delta.exchange/#candlesticks)
