Unable to get 5 min historical data

For 1 min interval historical data displaying but if i give 5 min ‘Please select valid resolution’ like this shows. Only 1 min and ‘D’ only working. 5, 15, 30, 60, etc. not working. Below code only i run.
Kindly anyone guide me on how to take different interval historical data. Thank You !

from pya3 import *
import pandas as pd
from datetime import datetime, timedelta

instrument = alice.get_instrument_by_symbol(“NFO”, “NIFTY2372019350CE”)
from_datetime = datetime.now() - timedelta(days=1) # From last & days
to_datetime = datetime.now() # To now
interval = “5” # [“1”, “D”]
indices = False # For Getting index data
print(alice.get_historical(instrument, from_datetime, to_datetime, interval, indices))

Regards,

Mohan Raj

Do the pandas resampleing with Aggregator.
price_mapping = {
“open”: “first”,
“high”: “max”,
“low”: “min”,
“close”: “last”
}
df.resample(“5T”).agg(price_mapping)

Morereference : Aggregating Time Series Data with Pandas Resampling - αlphαrithms

1 Like

Hi sir
Thank you so much! Now i’m able to get historical data on different time frames :pray: