Learn Algo Trading with Python | Codes | Youtube Series

While running the WebSocket aim Geeting august 2024 data and data is update automatically

Advanced Algo Trading Series | Episode 3: Connecting Your Algo With Excel | Part 2

@Tradehull_Imran Sir I enjoyed very much this video.
N what a ending statement “AKHRI AKHRI DIN HAIN MANUAL TRADING KE ENJOY KARLO…”
I can’t stop laughing :rofl: :rofl: :rofl: :rofl:

1 Like

Hi @Tradehull_Imran Sir,
I want to display stock option chain like indusind and TCS in excel. It’s not working for me like nifty option chain. Can you please share reference code for stock option chain.
Thanks in advance.

Getting same problem… “num_strike” is not working

@Tradehull_Imran sir, please help us to resolve this error.

We have to wait till the library is updated before it becomes available.

Till then we have to wait. They are working on it!

Sir informed in prior threads!

it’s a slicing problem and an ATM fetching problem, if I implement is before its available, ill let you know!

2 Likes

index_exchange = {"NIFTY":'NSE',"BANKNIFTY":"NSE","FINNIFTY":"NSE","MIDCPNIFTY":"NSE","BANKEX":"BSE","SENSEX":"BSE","INDIA VIX":"NSE"}

I made change as suggested to get ltp data for INDIA VIX, and it is working , thank you.

To get historical data chart = tsl.get_historical_data(‘INDIA VIX’, ‘INDEX’, ‘1’)

I replaced index_exchange = {“NIFTY”:‘NSE’,“BANKNIFTY”:“NSE”,“FINNIFTY”:“NSE”,“MIDCPNIFTY”:“NSE”,“BANKEX”:“BSE”,“SENSEX”:“BSE”,“INDIA VIX”:“NSE”}
in get_historical_data function, and now it is working.

2 Likes

Not all the times we are getting the wrong ATM selection, but yes some of the times it is giving wrong ATM/OTM selection, particularly for NIFTY. For NIFTY index it is giving FINNIFTY ce/pe strike and symbol name.

1 Like

@Tradehull_Imran Sir, I am able to fetch historical data for stocks but not for index Nifty/Banknifty. Ouput is showing as EMPTY DATAFRAME. Tried using NSE_IDX as well, still unable to fetch historical data. Please guide.

@TusharKB
I am able to fetch using this code-for 1 min & 5 min intervals/timeframe

data_1min = tsl.get_historical_data("NIFTY", "INDEX", "1")
data_5min = tsl.get_historical_data("NIFTY", "INDEX", "5")

use “INDEX” for indices and “NSE” for stocks. Also, not sure that data is provided for 12 mins, as seen in your case. I think timeframes are: “1”,“5”, “15”, “60”, and “DAY”. Hope this is helpful…

1 Like

Hi @phani_m ,

Do use the below code to get the stock option chain like TCS and display in excel:

option_chain = tsl.get_option_chain(Underlying="TCS", exchange="NSE", expiry=0)
option_chain.to_csv('TCS_option_chain.csv')

Hi @Siddesh ,

We will release new version soon which supports num_strike parameter.

1 Like

Hi @Delta_Trading ,

We will look into this issue.

@anandc I tried the code shared by you data_1min but getting error as unsupported type for timedelta days component: str . I am looking for previous 12days historical data. For intraday i am using the code for 1 min as intraday_hist_data = tsl.get_intraday_data(‘SBIN’,‘NSE’,1) The codes which i am using is working for stocks only and getting error in case of Indices.

Hi @TusharKB ,

Do use the below code to get for Nifty/Banknifty:

nifty_data = tsl.get_historical_data('BANKNIFTY', 'INDEX', '1')
banknifty_data = tsl.get_historical_data('NIFTY', 'INDEX', '1')

Hi @anandc ,

You can share the whole code here itself by sending preformatted text box present like the below:

image

Hi @TusharKB ,

tsl.get_intraday_data was a old method to get historical data… it gives data only for today, which makes problem if we want to create indicators on it.

Dhanhq is upgraded and now we can use get_historical_data which gives data for last 5 working days.

1 Like

Hi @Jana_HS ,

Managing WebSocket can be complex, so we’ve designed our codebase to work with rest api calls, allowing you to add or remove instruments directly with ease.

Do update codebase on your system

  • 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 video for updated codebase :

Noted thanks. that makes it difficult to backtest any strategy with fewer historical data.

does any one else facing ltp ddata issue in dhan today for equity and option? please reply