Why response code is not always available in fyers historic api query response ?

range_from = int(datetime.datetime.strptime('2014-01-01 00:00:00','%Y-%m-%d %H:%M:%S').timestamp())
    range_to = int(datetime.datetime.strptime('2014-12-01 00:00:00','%Y-%m-%d %H:%M:%S').timestamp())
request_data = {"symbol": 'BSE:3BBLACKBIO-X',
                "resolution": 'D',
                "date_format": "0",
                "range_from": range_from,
                "range_to": range_to,
                "cont_flag": "0"}

response = fyers_model.history(data=request_data)

# below is logged response from fyers api
response : {'candles': [], 'message': '', 's': 'no_data'}

Here, I have purposely chosen a stock unavailable in the above test date range to test my code's error handling. But to my surprise, Fyers' response does not always contain a response code, making it hard to handle unanticipated errors. Why response code is not present in every Fyers response?

1 reply