Codebase Update: New Features Added in Dhan_TradeHull

Hi @Sahil_Malhotra ,

Do update the codebase according to the latest version, refer the below thread on how to update codebase -
Dhan_Tradehull Library Update: Python 3.12 & Authentication Improvements - APIs, Automation, Algos & Code - MadeForTrade

Hi @Tradehull_Imran

I tried using the resample_data function and it was working fine as well but from last couple of days it is not giving me any data and returning empty dataframe.

Can you please take a look at the screenshot for reference.

Also can you tell me if you see any issue in the code statements below.

They behave differently every time and also gives exception. I never get ltp for both pe and ce if I try it this way. However when i run using pdb individually it works fine.

ce_name, pe_name, ce_strike, pe_strike = tsl.ITM_Strike_Selection(Underlying=‘NIFTY’, Expiry=0, ITM_count=1)
atm_pe_ltp = tsl.get_ltp_data(pe_name)
atm_ce_ltp = tsl.get_ltp_data(ce_name)
print("ATM CE STRIKE : ", ce_name , " - ATM CE LTP : ", atm_ce_ltp[ce_name]) # to get LTP only use [ce_name]
print("ATM PE STRIKE : ", pe_name , " - ATM PE LTP : ", atm_pe_ltp)

Error Message

Exception at calling ltp as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: None, ‘error_type’: None, ‘error_message’: None}, ‘data’: ‘’}
ATM CE STRIKE : NIFTY 17 FEB 25750 CALL - ATM CE LTP : 154.05
ATM PE STRIKE : NIFTY 17 FEB 25850 PUT - ATM PE LTP : {}

Thanks

Hi @Dipika_Bajaj ,

Firstly do update the codebase referring the below link, and use pin + totp method to login and to avoid access token generation everyday.

If you already moved to Python 3.12, using Dhan-Tradehull 3.2.0, then

chart_3=tsl.resample_timeframe(chart, ‘3T’)

will not work, because Python 3.12 does not recognize ‘T’.

You should use chart_3=tsl.resample_timeframe(chart, ‘3min’).