Python client 2.8 is out with historical() data call

  • menaveenn
    Hi Kailash,

    Im unable to get historical data. I tried pulling data for TATAPOWER.
    Can you help me out from this?
    Note:I was able to pull the data on friday.I can get information like margins and has problem only in pulling historical data.


    The below error I'm getting .

    his=kite.historical('877057','2016-02-03','2016-02-03','minute')
    ---------------------------------------------------------------------------
    DataException Traceback (most recent call last)
    in ()
    ----> 1 his=kite.historical('877057','2016-02-03','2016-02-03','minute')

    /usr/local/lib/python2.7/dist-packages/kiteconnect/__init__.pyc in historical(self, instrument_token, from_date, to_date, interval)
    388 "from": from_date,
    389 "to": to_date,
    --> 390 "interval": interval})
    391
    392 records = []

    /usr/local/lib/python2.7/dist-packages/kiteconnect/__init__.pyc in _get(self, route, params)
    426 def _get(self, route, params=None):
    427 """Alias for sending a GET request."""
    --> 428 return self._request(route, "GET", params)
    429
    430 def _post(self, route, params=None):

    /usr/local/lib/python2.7/dist-packages/kiteconnect/__init__.pyc in _request(self, route, method, parameters)
    520 return r.content
    521 else:
    --> 522 raise ex.DataException("Unknown Content-Type in response")

    DataException: Unknown Content-Type in response


    Thanks,
    Naveen
  • Kailash
    Hi @menaveenn , looking into this.
  • Kailash
    Kailash edited May 2016
    I was able to get the response. Try passing the token as an int and not a string. Eg:
    kite.historical(877057, "2016-02-03" , "2016-02-03", "minute")
  • menaveenn
    Thank you Kailash,I think its good to have str to int conversion in the method as all other parameters we are passing as strings.
  • conquistadorjd
    I have following questions.
    1. What is the maximum date range for which we can fetch data ? e.g. on NSE website, we can fetch data only for 365 days, is there any restriction like that ?
    2. lets assume I am fetching data @ 11 AM and I want to fetch data for the same day for intraday trading for the interval of 15 mins. Is it possible ? OR only current day -1 data is available ?
Sign In or Register to comment.