Bug in tradebook API

Every time I am trying to fetch tradebook from url https://api.dhan.co/trades using GET request, I am getting following error
{‘errorCode’: ‘TRADE_RESOURCE_ERROR’, ‘httpStatus’: ‘BAD_REQUEST’, ‘internalErrorCode’: ‘’, ‘internalErrorMessage’: ‘’}

same error in dhan.get_trade_book() method using dhanhq python module

I am able to fetch orderbook from ‘https://api.dhan.co/orders

@Hardik, @Poornima, @Divyesh

Can anyone help me on this? Still I have not been able to get any response from URL https://api.dhan.co/trades.

Also Dhan orderbook from API does not contain any average price field. There is an Price field, but it shows the price at which order is placed. Still there is no way to get average price of an order through API.

Hi @rudra

We tried at our end and it is working fine. Hope you are not trying this on weekend (off trading day) , as on weekend there are not trades available in tradebook.

Request you to try now and if you still see any issue, let us know with the error message.

import requests

acesstoken = “ACCESS_TOKEN”
headers = {‘Content-Type’ : ‘application/json’, ‘access-token’ : acesstoken}
url = ‘https://api.dhan.co/trades
r = requests.get(url, headers = headers)
print(r.json())

I am using the above. here is the json output of above code -
{‘errorCode’: ‘TRADE_RESOURCE_ERROR’, ‘httpStatus’: ‘BAD_REQUEST’, ‘internalErrorCode’: ‘’, ‘internalErrorMessage’: ‘’}

This Works:

import requests

acesstoken = 'TOKEN'
headers = {'Content-Type' : 'application/json', 'access-token' : acesstoken}
url = 'https://api.dhan.co/trades'
r = requests.get(url, headers = headers)
print(r.json())

@Naman

Same code is working fine for other users. But not for me.
I am able to access orderbook. But everytime I try fetching tradebook, same error is coming.

I think this is client specific problem. Please let me know what to do.

Hello @rudra

Requesting you to kindly try this today during market hours and in case you are facing the same issue, we can take a look at the system logs for the same. You can send your User ID on api@dhan.co.

I have run this during market hours. Same error is there. I have sent all the details to api@dhan.co with my client id.