HI @Alok_Ranjan ,
We have updated the Dhan-Tradehull .
Do run the below commands in cmd terminal-
pip install dhanhq==2.2.0
pip install Dhan-Tradehull==3.3.2
Follow the remaining steps :
Step 1: Run the following command:
pip show Dhan_tradehull
Step 2: Copy the location path shown in the output, similar to the example below:
c:\users\Test\appdata\local\programs\python\python310\lib\site-packages
Step 3: Paste the copied path into File Explorer.
Step 4: Search for the Dhan_Tradehull folder and open it.
Step 5: Locate the Dhan_Tradehull.py file and open it.
Step 6: Search for the following line (CTRL + F) will find the dictionary:
self.commodity_step_dict = {'GOLD': 100,'SILVER': 250,'CRUDEOIL': 50,'NATURALGAS': 5,'COPPER': 5,'NICKEL': 10,'ZINC': 2.5,'LEAD': 1, 'ALUMINIUM': 1, 'COTTON': 100, 'MENTHAOIL': 10, 'GOLDM': 50, 'GOLDPETAL': 5, 'GOLDGUINEA': 10, 'SILVERM': 250, 'SILVERMIC': 10, 'BRASS': 5, 'CASTORSEED': 100, 'COTTONSEEDOILCAKE''CARDAMOM': 50, 'RBDPALMOLEIN': 10,'CRUDEPALMOIL': 10,'PEPPER': 100, 'JEERA': 100, 'SOYABEAN': 50, 'SOYAOIL': 10, 'TURMERIC': 100, 'GUARGUM': 100, 'GUARSEED': 100, 'CHANA': 50, 'MUSTARDSEED': 50, 'BARLEY': 50, 'SUGARM': 50, 'WHEAT': 50, 'MAIZE': 50, 'PADDY': 50, 'BAJRA': 50, 'JUTE': 50, 'RUBBER': 100, 'COFFEE': 50, 'COPRA': 50, 'SESAMESEED': 50, 'TEA': 100, 'KAPAS': 100, 'BARLEYFEED': 50, 'RAPESEED': 50, 'LINSEED': 50, 'SUNFLOWER': 50, 'CORIANDER': 50, 'CUMINSEED': 100 }
Step 7: Replace the following line and save the file to use the NATURALGASMINI data(CTRL +S):
self.commodity_step_dict = {'GOLD': 100,'SILVER': 250,'CRUDEOIL': 50,'CRUDEOILM': 50,'NATURALGAS': 5,'NATGASMINI' : 5 ,'COPPER': 5,'NICKEL': 10,'ZINC': 2.5,'LEAD': 1, 'ALUMINIUM': 1, 'COTTON': 100, 'MENTHAOIL': 10, 'GOLDM': 50, 'GOLDPETAL': 5, 'GOLDGUINEA': 10, 'SILVERM': 250, 'SILVERMIC': 10, 'BRASS': 5, 'CASTORSEED': 100, 'COTTONSEEDOILCAKE''CARDAMOM': 50, 'RBDPALMOLEIN': 10,'CRUDEPALMOIL': 10,'PEPPER': 100, 'JEERA': 100, 'SOYABEAN': 50, 'SOYAOIL': 10, 'TURMERIC': 100, 'GUARGUM': 100, 'GUARSEED': 100, 'CHANA': 50, 'MUSTARDSEED': 50, 'BARLEY': 50, 'SUGARM': 50, 'WHEAT': 50, 'MAIZE': 50, 'PADDY': 50, 'BAJRA': 50, 'JUTE': 50, 'RUBBER': 100, 'COFFEE': 50, 'COPRA': 50, 'SESAMESEED': 50, 'TEA': 100, 'KAPAS': 100, 'BARLEYFEED': 50, 'RAPESEED': 50, 'LINSEED': 50, 'SUNFLOWER': 50, 'CORIANDER': 50, 'CUMINSEED': 100 }
After these steps refer the code provided below -
Refer the code -
from Dhan_Tradehull import Tradehull
client_code = ""
tsl = Tradehull(client_code, mode="pin_totp", pin="", totp_secret="")
ce_strike, pe_strike, strike = tsl.ATM_Strike_Selection('CRUDEOILM',0)
print(f'CRUDEOILM : {ce_strike}, {pe_strike}, {strike}')
Output -
