Invalid trade history for Dhan API

Hello, I have been using following snippet of code to get trade history, It worked so well till now, But from past days, there is a lack of trades for a given day like 23 May for so many symbols, Could you please look into this?

def _fetch_trade_book(self, start_date, end_date):
    self._tradebookfull = []
    page = 0
    while True:
        data = self._dhan.get_trade_history(start_date, end_date, page)
        if data['status'] == 'failure' and data['remarks']['error_code'] == 'HTTP429':
            time.sleep(1)
            continue
        page += 1
        if not data['data']:
            break
        self._tradebookfull.extend(data['data'])

@Hardik Anyone would care to reply?

For example, this trade is duplicated

{
	"brokerageCharges": 0.0,
	"createTime": "NA",
	"customSymbol": "ICICI Pru BSE Midcap Select ETF",
	"dhanClientId": "1100063652",
	"drvExpiryDate": "NA",
	"drvOptionType": "NA",
	"drvStrikePrice": 0.0,
	"exchangeOrderId": "1200000016216121",
	"exchangeSegment": "NSE_EQ",
	"exchangeTime": "2025-05-19 10:00:46",
	"exchangeTradeId": "0",
	"exchangeTransactionCharges": 0.0195,
	"instrument": "EQUITY",
	"isin": "INF109KC10W0",
	"orderId": "7125051915281",
	"orderType": "MARKET",
	"productType": "CNC",
	"sebiTax": 0.0029,
	"securityId": "17702",
	"serviceTax": 0.0046,
	"stampDuty": -0.07,
	"stt": 0.0,
	"tradedPrice": 17.22,
	"tradedQuantity": 29,
	"tradingSymbol": null,
	"transactionType": "BUY",
	"updateTime": "NA"
},

Hello @killer3d

There shouldn’t be such discrepancy, that too in historical trades data. I just tried replicating the exact scenario, but couldn’t. Will need to check this on logs itself.

Can you please share the timestamp along with the date when you requested historical data, would be helpful to debug faster.

There is , I can confirm this as trade history from multiple accounts are broken
Have start date as 1 may 24 , end date today and try to get trades page by page

Sometimes, dupliocate entries are responded and sometimes buy orders are not responded, It shows correct info on Dhan web page in Trades section
Issue only with API