How to get previous day close price

gmax edited December 2017 in Python client
I am trying to check whether todays open price above yesterdays close price. can you help how to get this ?

Will this provide ?


  • sujith
    You can check out documentation . In the response, open means open of the day and close is the previous day's close.
  • gmax
    gmax edited December 2017
    Thanks for the response.

    I am using this.

    prev_close = kite.quote(exchange1,symbol1)["ohlc"]["close"]

    But this used to pull errors also. Any suggestions ?

    DataException                             Traceback (most recent call last)
    ~\st\ in <module>()
    99 #prev_close = 147
    --> 100 prev_close = kite.quote(exchange1,symbol1)["ohlc"]["close"]
    ~\AppData\Local\Continuum\anaconda3\lib\site-packages\kiteconnect\ in quote(self, exchange, tradingsymbol)
    499 def quote(self, exchange, tradingsymbol):
    500 """Retrieve quote and market depth for an instrument."""
    --> 501 return self._get("market.quote", {"exchange": exchange, "tradingsymbol": tradingsymbol})
    503 def historical(self, instrument_token, from_date, to_date, interval, continuous=False):

    ~\AppData\Local\Continuum\anaconda3\lib\site-packages\kiteconnect\ in _get(self, route, params)
    575 def _get(self, route, params=None):
    576 """Alias for sending a GET request."""
    --> 577 return self._request(route, "GET", params)
    579 def _post(self, route, params=None):

    ~\AppData\Local\Continuum\anaconda3\lib\site-packages\kiteconnect\ in _request(self, route, method, parameters)
    666 code=r.status_code))
    667 elif exp:
    --> 668 raise(exp(data["message"], code=r.status_code))
    669 else:
    670 raise(ex.GeneralException(data["message"], code=r.status_code))

    DataException: Exception fetching quote
  • sujith
    We are going to make a release in couple of days to add bulk fetch APIs as mentioned here.
  • sujith
    Once we add it you can use that.
  • sujith
    We made a new pykiteconnect release. You can use this
Sign In or Register to comment.