@Tradehull_Imran
Exception in Getting OHLC data as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-904’, ‘error_type’: ‘Rate_Limit’, ‘error_message’: ‘Too many requests on server from single user breaching rate limits. Try throttling API calls.’}, ‘data’: {‘errorType’: ‘Rate_Limit’, ‘errorCode’: ‘DH-904’, ‘errorMessage’: ‘Too many requests on server from single user breaching rate limits. Try throttling API calls.’}}
Error fetching data for ACC: ‘NoneType’ object has no attribute ‘empty’
@Tradehull_Imran
Getting below error while execute programm at below line
chart = tsl.get_intraday_data(stock_name, ‘NSE’, 1);
Error:
ERROR:2025-02-15 12:17:05,770:MainThread:Exception in Getting OHLC data as intraday_minute_data() missing 2 required positional arguments: ‘from_date’ and ‘to_date’
Traceback (most recent call last):
File “E:\Automation_Trade\Strategy\Dhan_Tradehull.py”, line 253, in get_intraday_data
ohlc = self.Dhan.intraday_minute_data(str(security_id),exchangeSegment,instrument_type)
TypeError: intraday_minute_data() missing 2 required positional arguments: ‘from_date’ and ‘to_date’
Hi sir @Tradehull_Imran
With your help, I was able to complete my algorithm,
I have been testing it for a few days on paper trade, it’s working fine!
Thank you again.
The final step left for me is, uploading it on a virtual machine or some sort of cloud computation.
I know you are already working on a tutorial for it, but if you could drop a hint on which platform or anything, I will pick up the rest on my own
I’m also getting this error although dhanhq is showing installed its in the same folder. What shall I do?
use Amazon web server free for first 12 months, create an EC2 windows instance, load everything on it as u did on ur laptop…it will work great
key expired… use new key
Thank you, ill give it a try !
Imran Sir,
A big thank you to you! With your expert guidance, we have successfully built and deployed our algorithms.
For the advanced algorithm series (Pandas implementation), we will use VS Code or Sublime Text.
sir , I have ZERO knowledge on python or ZERO knowledge on other codings too. I have completed session 2 n ow starting session 3 i.e. codebase .
My queries are –
1-- Will I be able to to design my own algo just by following yt tut series ?
2-- first I wish to built for paper trading model ( later to design duel options where one can switch between real mrkt mode or paper mode)
sorry for replying to this thread as I dont know where to ask this q.
thanking you
@Tradehull_Imran ,sir kindly reply . I want to made duel model , so that I can do paper trade … can it be possible ?
Yes, you can add conditions to track RSI upticks and downticks using flags in your code. Flags act as boolean variables that store whether the RSI has increased (uptick) or decreased (downtick) compared to the previous value
@Tradehull_Imran
Sir, I want to fetch live OI data using WebSocket for all my stocks from market opening to market close.
How can I do this? Can anyone please help me?
Hi @Prakash_Maurya ,
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 was upgraded and now we can use get_historical_data which gives data for last 5 working days.
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:
- Arguments:
data = tsl.get_historical_data(tradingsymbol='NIFTY', exchange='INDEX', timeframe="DAY")
data = tsl.get_historical_data(tradingsymbol='ACC', exchange='NSE', timeframe="1")
Do use the upgraded codebase, refer the below video :
how can we get india vix data?
use below code
cc_1 = df.iloc[-1]
cc_2 = df.iloc[-2]
uptick = (cc_1['RSI'] > 30) and (cc_2['RSI'] < 30)
downtick = (cc_1['RSI'] < 70) and (cc_2['RSI'] > 70)
Hi @Raju2 ,
Refer the below code:
name = "TCS 27 FEB 3900 CALL"
quote_data = tsl.get_quote(name)
oi_data = quote_data[name]['oi']
Do use our latest codebase:
Sir, I have 120 stocks, and I need ATM, 2 OTM, and 2 ITM data continuously from market opening to market close for all my stocks.
The code you sent has a rate limit and is not an efficient way to fetch OI data continuously.
Please help me achieve this using WebSocket if possible. If there is a better way, please let me know. I have already watched your videos as well.
Hi @Tradehull_Imran …
Awaiting for your reply on this please…?
You can use the following code to fetch option chain data
option_chain = tsl.get_option_chain(Underlying="NIFTY", exchange="INDEX", expiry=0)