I have started my journey with Algo trading and installed all the required software, VSCODE, Python etc. While testing to check my holdings, I received an error message “ImportError: cannot import name ‘Sequence’ from ‘collections’ (C:\Users\HP\AppData\Local\Programs\Python\Python314\Lib\collections_init_.py)”
Can someone provide help on this please!!!
First install latest version of dhanhq using
pip install dhanhq==2.1.0
then use this code
from dhanhq import DhanContext, dhanhq
client_id = <>
access_token = <>
dhan_context = DhanContext(client_id,access_token)
dhan = dhanhq(dhan_context)
print(dhan.get_positions())
Refer docs on github
hey @kvvnadh80 ,
Welcome to Madefortrade,
We request you to kindly follow the below step for installing package and integration.
Step 1: Install package.
pip install dhanhq==2.1.0
Step 2: Import library.
from dhanhq import DhanContext, dhanhq
dhan_context = DhanContext(“client_id”,“access_token”)
dhan = dhanhq(dhan_context)
Step 3: Run the function.
dhan.get_holdings()
Also , we tried connecting you over your registered number , but it seems you were unavailable at the time.
Incase you are still facing error then we request you to kindly help us with the error code over mail help@dhan.co.
I am still facing the same error
File “c:\Users\HP\pathlib.py”, line 10, in
from collections import Sequence
ImportError: cannot import name ‘Sequence’ from ‘collections’ (C:\Users\HP\AppData\Local\Programs\Python\Python314\Lib\collections_init_.py)
I have sent an email you provided