I use APIv3 historical data to fetch data for 5min timeframe. It returns OHLC and timestamp but doesn’t return volume column data properly.
In all records, under volume column, it is 0.
Is there any glitch or anything wrong?
I use APIv3 historical data to fetch data for 5min timeframe. It returns OHLC and timestamp but doesn’t return volume column data properly.
In all records, under volume column, it is 0.
Is there any glitch or anything wrong?
Hi Alpesh,
Sorry for the inconvenience.
Can you please share few details to debug this further, symbol name, timeframe you are trying to fetch.
def fetch_historical_data(fyers, symbol, start_date, end_date, interval):
# Parameters values passed as below
# symbol = "NIFTY": "NSE:NIFTY50-INDEX"
# start_date = "2024-01-01"
# end_date = "2024-03-31"
# interval = "5"
data = {
"symbol": symbol,
"resolution": interval,
"date_format": "1", # 1 means 'yyyy-mm-dd'
"range_from": start_date,
"range_to": end_date,
"cont_flag": "1",
"oi_flag": "1"
}
# Below function executes /hostory method.
response = fyers.history(data=data)
if response.get("s") == "ok" and "candles" in response:
df = pd.DataFrame(response["candles"], columns=['Timestamp', 'Open', 'High', 'Low', 'Close', 'Volume'])
return df
else:
print(f"Error fetching data for {symbol}: {response.get('message', 'Unknown Error')}")
return pd.DataFrame()
Rows from the response I receive
DateTime,Open,High,Low,Close,Volume
2024-01-01 09:15:00,21727.8,21737.3,21693.6,21693.8,0
2024-01-01 09:20:00,21693.9,21701.1,21684.8,21695.7,0
2024-01-01 09:25:00,21697.3,21704.1,21693.2,21700.8,0
2024-01-01 09:30:00,21700.2,21705.8,21684.1,21703.1,0
2024-01-01 09:35:00,21702.2,21711.9,21689.7,21689.7,0
2024-01-01 09:40:00,21688.0,21708.4,21685.8,21706.1,0
2024-01-01 09:45:00,21705.4,21720.7,21703.3,21720.4,0
2024-01-01 09:50:00,21719.3,21737.7,21717.7,21731.4,0
2024-01-01 09:55:00,21731.9,21732.8,21720.1,21726.3,0
2024-01-01 10:00:00,21726.6,21732.2,21721.5,21723.0,0
2024-01-01 10:05:00,21723.5,21727.1,21709.1,21714.6,0
2024-01-01 10:10:00,21714.7,21714.7,21702.8,21709.7,0
FYI, last column value 0 is for volume.
Thanks for sharing details, @107389824402050226664
You are fetching Index volume data. Index volume data is available from 1st July 2025. Reference:
Understood.
Thank you @naresh_janagama for the assistance.