Hello Team,
I am using the latest version of the Upstox Python API and fetching intraday candles using:
get_intra_day_candle_data()
I have observed inconsistent behavior regarding the handling of the currently forming candle.
Problem Description
When requesting intraday candle data during market hours:
Case 1: 5-Minute Timeframe
Example scenario:
- Market opens at:
09:15:00 - 5-minute candle interval:
09:15:00to09:19:59 - Candle officially completes at:
09:20:00
Observed Behavior
If I request candle data at:
09:15:10→ 09:15 candle NOT returned09:15:45→ 09:15 candle NOT returned09:16:01→ 09:15 candle appears in response
This implies the 09:15 candle is being returned before completion.
However, logically:
A 5-minute candle starting at 09:15 should only be considered complete at 09:20.
Case 2: 1-Minute Timeframe
For 1-minute candles:
- The currently forming 1-minute candle is never returned.
- It only appears after it closes.
This creates inconsistent behavior across timeframes.
Logical Expectation
If the API is designed to return only completed candles, then:
For a 5-minute timeframe:
- Candle start time:
09:15:00 - Candle end time:
09:19:59 - Completion time:
09:20:00
Therefore:
The 09:15 candle should appear in the response only at or after 09:20:00.
However, it appears around 09:16:00, which suggests it is being returned as a partially formed candle.
Additional User Perspective Concern
From a user standpoint, I actually prefer receiving live candle formation data, as it is useful for intraday strategy execution.
However, my concern is:
If partially forming candles are intended to be returned, then:
- Why is the candle not visible immediately at its start time (e.g., 09:15:00)?
- Why does it begin appearing only after approximately one minute (e.g., 09:16:00)?
If live candles are supported, then the 1-minute timeframe should ideally:
- Return the current forming 1-minute candle from the start of the minute.
- Continuously update its OHLC and volume.
If 1-minute live candles are consistently available from their starting second, this issue would effectively be resolved from a strategy perspective.
The current behavior creates ambiguity:
- It is neither clearly “completed candles only”
- Nor clearly “live forming candles”
A clear and consistent rule would greatly help systematic traders.
Reproducible Steps
-
Start market session.
-
At
09:15:xx, call:get_intra_day_candle_data()with
interval = "5minute" -
Observe that:
- 09:15 candle does not appear immediately.
- Around 09:16, the 09:15 candle appears.
-
Repeat similar test with
interval = "1minute"and observe that the current minute candle is never returned while forming.
Questions
-
Is this expected behavior?
-
Does
get_intra_day_candle_data()intentionally return partially formed candles? -
If yes:
- Why does it not return them immediately at candle start?
-
If no:
- Is this a synchronization or data aggregation issue?
-
What is the recommended way to reliably access live intraday OHLC data?
- Should developers rely entirely on WebSocket tick aggregation?
Why This Matters
For systematic intraday trading systems:
-
Entry logic often depends on:
- Breakout of current candle high
- Momentum shifts within active candle
- Intrabar volume analysis
Ambiguity in candle completeness makes deterministic strategy design difficult.
A clear clarification on whether the endpoint returns:
- Only completed candles
- Partially forming candles
- Or a hybrid approach
would greatly help developers design robust systems.
Looking forward to clarification.
Thank you.