Sample Python code to use the Dhan DATA API

Hello,

is there any sample code available which shows the data extraction from DHAN DATA API to a dataframe for all nifity 500 stocks.

Thanks

Hi @siva_subramanian
Use below code


from Dhan_Tradehull import Tradehull
import pandas as pd


client_code = "client_code"
token_id = "token_id"

tsl = Tradehull(client_code,token_id) # tradehull_support_library


nifty_500_watchlist = ['ACC', 'CIPLA', 'GAIL', ... ]

for stock_name in nifty_500_watchlist: 

	chart = tsl.get_intraday_data(stock_name,'NSE',1)

Thanks so much for the quick response. @Tradehull_Imran

The Dhan_Tradehull is unresolved. i tried pip install still not working. sorry for a basic question.

I have run the .bat from your session 1, but in that also i didnt find any installation for tradebull

Hey there i am trying to use DHAN DATAPI i am trying to get response for API and I am using POSTMAN following is the JSON :

@Tradehull_Imran Expecting an early response!

@Tradehull_Imran sir same problem happend with me

Hi @siva_subramanian @T.Y.A-60_Priti_Vadde

we don’t have to do pip install Dhan_Tradehull

for installation process see this video : https://www.youtube.com/watch?v=YAyIoDJYorA&list=PLnuHyqUCoJsPA4l9KRLrNpWLIfZ9ucLxx&index=8

Also do check, Dhan_Tradehull and Dhan_codebase usage should live in same folder

Hi @Tanmay_Joshi

Missed you question before

Do check this , also we can directly use wrapper , to ease out the development process : https://youtu.be/HLiEpNZSD80?si=mtN6S5LoDCs79z2q&t=1303