A newbie here.
I am trying to collect historical data and able to get it. Only Issue is how can i convert and save it in a tabular format.
My Code is very Simple:
symbols = [‘TCS’,‘NTPC’]
for symbol in symbols:
symbol_data = dhan.historical_minute_charts(
Welcome to Dhan Community!
Great to see you try your hands on Dhan API. Since you are using our Python Library, you can use pandas to save this data in tabular form.
You can refer to our API video series wherein Ritwik has explained how to achieve this - here
I was able to solve it using pandas Only and below is the code where it will ask for User to input and store the data in Panda Dataframe.
for symbol in stocks:
stocks_data = dhan.historical_minute_charts(
stock_df = pd.DataFrame(stocks_data[‘data’])
stock_df.columns = [‘OPEN’, ‘HIGH’, ‘LOW’, ‘CLOSE’, ‘VOLUME’, ‘START_TIME’]
stock_df[‘START_TIME’] = pd.to_datetime(stock_df[‘START_TIME’], unit=‘s’).dt.date
stock_df.insert(0, ‘STOCK’, symbol)
df = pd.concat([df, stock_df])
@Hardik , What would be parameter for placing EQUITY FNO order using DHAN APi?
Example: DLF 480 CALL 31 AUG.
If you want to place Equity FnO, then you just need
exchange_segment as ‘NSE_FNO’ and rest all the parameters can remain same. Do make sure you are entering the Security ID for the Equity Options instrument and along with that, the quantity is entered as per the lot size.
Hi @Hardik ,
What is the way to get live data market?
We are working on building our own Websockets for Live Market Feed and will be releasing it soon.
We will reach out to you and announce it on the community first as soon as we are ready with this.
One more thing as a feature. I check DHAN API where it can gives you major information like OHLCV but for derivative , i am not sure if there are options to get options greek for both equity derivative and index derivative.
Yes, we do not provide Greek values as part of our Data APIs. But once with Market Feed, you will be able to calculate this as you will have all the required data to do so.