Hello, I want to know maximum number of stock data we can import through access code generated on DhanHQ trading API?
Hello @piyush_chandravanshi
Welcome to Dhan Community!
You can subscribe to upto 5000 instruments in a single websocket and establish 5 different connections with a single access token itself. There is no limitation here on the basis of access token.
while runing this code
from dhanhq import dhanhq
dhan = dhanhq(“client_id”,“access_token”)
access_token = “eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJkaGFuIiwicGFydG5lcklkIjoiIiwiZXhwIjoxNzE0ODgxNDg1LCJ0b2tlbkNvbnN1bWVyVHlwZSI6IlNFTEYiLCJ3ZWJob29rVXJsIjoiIiwiZGhhbkNsaWVudElkIjoiMTEwMjc2ODQzNiJ9.QF7wnHYOA14RNeMj20igEYJ1vgXyDje1mFMaoJFx9mxYWHNfVn0wAkArdfwlL7eN8VQxhixWzeX7399HpprL9w”
client_id = “1102***436”
c = dhan.get_positions()
print(c)
I m getting this error
{‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘RS-9005’, ‘message’: ‘The token was expected to have 3 parts, but got 1.’}, ‘data’: ‘’}
what to do???
Hello @piyush_chandravanshi
This is a simple python error where you are defining client_id
and access_token
as variable and yet using them as strings inside dhanhq
function.
Try replacing with this:
dhan = dhanhq(client_id,access_token)
Thank you. this was helpful!