I am trying to fetch data for Crudeoil Jan futures using below API call
But the data frame provides data until 3.30 P.M IST only.
df = tsl.get_intraday_data(
tradingsymbol=SYMBOL,
exchange=EXCHANGE,
timeframe=TIMEFRAME_MIN,
debug="NO",
)
what should be corrected to get data till Commodities market EOD.
Am i missing something here?
Any help is appreciated.
Thanks a lot!!!
R.Dinesh Kumaar.
Hi @Dinesh_Kumar_Rajendr ,
Do update to our latest codebase version 3.1.2:
- Open Command Prompt: Press Win, type cmd, and press Enter.
- Install Dhan-Tradehull: Run
pip install Dhan-Tradehull
- Confirm the installation by running
pip show Dhan-Tradehull
Refer the below pypi link for more details:
Dhan-Tradehull · PyPI
Codebase was upgraded and now we can use get_historical_data() function.
Retrieve historical or intraday data:
Get Historical Data
- tsl.get_historical_data(tradingsymbol: str, exchange: str, timeframe: str, debug: str = “NO”)
- Arguments:
- tradingsymbol (str): The trading symbol for the instrument you want to fetch data for (e.g., ‘NIFTY’, ‘ACC’).
- exchange (str): The exchange where the instrument is traded (e.g., ‘NSE’, ‘INDEX’).
- timeframe (str): The timeframe for the data. It can be:
- ‘1’ for 1-minute candles
- ‘5’ for 5-minute candles
- ‘15’ for 15-minute candles
- ‘25’ for 25-minute candles
- ‘60’ for 60-minute candles
- ‘DAY’ for daily candles
- debug (optional, str): Set to “YES” to enable detailed API response logging. Default is “NO”.
- Sample Code:
data = tsl.get_historical_data(tradingsymbol='CRUDEOIL', exchange='MCX', timeframe="1")
data = tsl.get_historical_data(tradingsymbol='ACC', exchange='NSE', timeframe="1")
1 Like
Res Sir
Even after updating, neither the Nifty nor the crude oil data is being fetched. The result shown is “None”.
Code is:
df = tsl. get_historical_data(tradingsymbol = ‘NIFTY 09 DEC 26200 CALL’,exchange = ‘NFO’ ,timeframe=“5”)
I would be grateful for the help.
Hi @kamlesh_ukey ,
Make sure your client ID is correct and regenerate your access token and re run the program.
Follow the below steps to update codebase-
• Install the required dhanhq version
pip install dhanhq==2.1.0
• Upgrade to the latest Dhan-Tradehull
pip install --upgrade Dhan-Tradehull
• Confirm the version’s for dhanhq if 2.1.0 and Dhan-Tradehull is 3.1.2
pip show dhanhq
pip show Dhan-Tradehull