Not able to install Kiteconnect

Pushwinder
Hello,

I am getting the following error while installing kiteconnect using pip install,
I upgraded pip and setuptools as well, kindly guide me further.

  • Pushwinder
    Thanks, Got that through,

    Now stuck at

    kite.request_access_token(request_token="obtained_request_token",
    secret="your_api_secret")

    it says,

    AttributeError: 'KiteConnect' object has no attribute 'request_access_token'
  • rakeshr
    @Pushwinder
    You are referring to older documentation, you need to refer version 3 document here.
  • Pushwinder
    One last thing,
    I am able to run this only once:

    def just_data():
    kws = KiteTicker(api_key,access_token)
    def on_ticks(ws,ticks):
    print(ticks)
    def on_connect(ws, response):
    ws.subscribe([*])
    ws.set_mode(ws.MODE_FULL,[*])
    def on_close(ws, code, reason):
    ws.stop()
    kws.on_ticks=on_ticks
    kws.on_connect=on_connect
    kws.on_close = on_close
    kws.connect()

    What's missing??

  • Pushwinder
    How to close the connection cleanly??
  • rakeshr
    @Pushwinder
    Have you called just_data() method, where kws is defined?
    Also, you can remove on_close method , if you want to keep reconnecting even after some error in between.
  • Pushwinder
    @rakeshr
    That's OK, I want to close the running program cleanly so that I could call it again without error.
    Mostly I use Ctrl+C to terminate the running program, is there any other means to terminate cleanly so that I can connect again.
  • rakeshr
    @Pushwinder
    You can call ws.close() inside on_tick method,if you want to close websocket connection based on condition.
    eg:
    def on_ticks(ws,ticks):
    *operation*
    if(required condition):
    ws.stop()
  • Pushwinder
    @rakeshr
    I am still getting this error

    raise error.ReactorNotRestartable()
    twisted.internet.error.ReactorNotRestartable
  • Pushwinder
    Pushwinder edited February 2019
    @rakeshr
    I am not able to take data using this syntax anymore,

    ticks['last_price']

    What is the alternative??
Sign In or Register to comment.