# Unable to get 5 min historical data

**URL:** <https://community.aliceblueonline.com/t/unable-to-get-5-min-historical-data/5505>\
**Category:** API\
**Created:** [July 14, 2023, 5:03pm UTC](https://community.aliceblueonline.com/t/unable-to-get-5-min-historical-data/5505 "2023-07-14T17:03:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohan\_Raj](https://sea1.discourse-cdn.com/flex015/user_avatar/community.aliceblueonline.com/mohan_raj/32/528_2.png) [@Mohan\_Raj](https://community.aliceblueonline.com/u/Mohan_Raj)\
**Post date:** [July 14, 2023, 5:03pm UTC](https://community.aliceblueonline.com/t/unable-to-get-5-min-historical-data/5505/1 "2023-07-14T17:03:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jayaraj\_Sankar](https://sea1.discourse-cdn.com/flex015/user_avatar/community.aliceblueonline.com/jayaraj_sankar/32/667_2.png) [@Jayaraj\_Sankar](https://community.aliceblueonline.com/u/Jayaraj_Sankar)\
**Post date:** [July 15, 2023, 10:18pm UTC](https://community.aliceblueonline.com/t/unable-to-get-5-min-historical-data/5505/2 "2023-07-15T22:18:45Z")

</div>

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](https://www.alpharithms.com/aggregating-time-series-data-with-pandas-resampling-411212/)

---

<div class="post-metadata">

**Author:** ![Mohan\_Raj](https://sea1.discourse-cdn.com/flex015/user_avatar/community.aliceblueonline.com/mohan_raj/32/528_2.png) [@Mohan\_Raj](https://community.aliceblueonline.com/u/Mohan_Raj)\
**Post date:** [July 16, 2023, 10:25am UTC](https://community.aliceblueonline.com/t/unable-to-get-5-min-historical-data/5505/3 "2023-07-16T10:25:50Z")

</div>

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