'error_code': 'RS-9005', 'message': 'The token was expected to have 3 parts, but got 1.'

GETTING THIS ERROR -

{'status': 'failure', 'remarks': {'error_code': 'RS-9005', 'message': 'The token was expected to have 3 parts, but got 1.'}, 'data': ''}

when running this -

#generate Dhan trading session
dhan_client_id = open("dhan_tokens.txt",'r').read().split()[0]
dhan_access_token = open("dhan_tokens.txt",'r').read().split()[1]
dhan = dhanhq("client_id","access_token")

dhan.get_fund_limits()

when i run the same in the API request page the response is fine. https://api.dhan.co/#/operations/fundlimit

Hello @Shrinivas100

This simply looks like there is an error in your script, where you have defined variables dhan_client_id and dhan_access_token but not used the same as arguments in the dhanhq class. You can try with the below snippet:

dhan = dhanhq(dhan_client_id,dhan_access_token)
1 Like

Ohh no. Sorry for a silly question.

1 Like

I have another issue though.
getting this error -

{‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘HTTP429’, ‘message’: ‘Your account is not authorize to use this API. Fulfill eligibility criteria or subscribe the plan.’}, ‘data’: ‘’}

when running -

                            option_hist_data = dhan.intraday_minute_data(token,exchange_segment='NSE_FNO',instrument_type='OPTSTK')
                            print(option_hist_data)

I understand that historical data is free if we make 25 FnO trades per month. Mine should definitely fall in this category.

Hey @Shrinivas100

We have changed the eligibility for Historical Data, as it has now been combined with Live Market Feed. You can subscribe data at a monthly subscription of ₹499 + taxes if you wish to use Historical or Live Market Data.

So it’s not free anymore right. It’s paid service

Yes @Shrinivas100

Here is the approach that we are taking for DhanHQ APIs:

Okay thanks for the information

I subscribed to the data around 1 hour back. But I get this error -


{'status': 'failure', 'remarks': {'error_code': 'RS-9005', 'message': 'Data not available'}, 'data': ''}

when trying to run this -

option_hist_data = dhan.intraday_minute_data(token,exchange_segment='NSE_FNO',instrument_type='OPTSTK')
print(option_hist_data)

the token is for the option - MCX24FEB3300CE
token generated is - ‘843441’

What could be the problem?

Hello @Shrinivas100

Over here, the security ID (token) being used by you is for MCX 29 Feb 3300 CE in BSE instead of NSE, hence the data is not shown. You can filter the same in the Security ID List by exchange.

The Security ID for MCX 29 Feb 3300 CE in NSE is ‘156312’.

Great thanks. Again silly miss

1 Like

Hi @Hardik

I have another query.
What is the delay in generating 1 min intraday historical data?

For example, if I want to get hist data for “WIPRO-Feb2024-540CE” option at exactly 9:16:00 will I get it within the next 1 second. What are your thoughts?

If there is significant delay, then what approach should i take to get options hist data using ticks data(websteram)

Also if I need to give date input to the intraday historical function how do I do it?

1 Like

Hi @Hardik ,

Any update on this

Hello @Shrinivas100

There is no measured delay as such with 1 min historical data. But if you want to call intraday data only, but at real-time then it is preferred to use websockets (market feed).

You can build candle data by storing incoming ticks in your local storage and then finding Open, High, Low and Close from the same.

Okay thanks for the inputs

1 Like

Can I give datetime input to this function -

dhan.intraday_minute_data()

Hello @Shrinivas100

Intraday Minute Charts only return data in format of 1 min OHLC for the current day. Hence, passing datetime input is not required in this function.

Okay thanks for the info