Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to connect to ticker #24

Open
MaheshCodeReader opened this issue Jul 28, 2021 · 12 comments
Open

Not able to connect to ticker #24

MaheshCodeReader opened this issue Jul 28, 2021 · 12 comments

Comments

@MaheshCodeReader
Copy link

Not able to connect to ticker

@luckyIITR
Copy link

I guess this is a temporary error from Zerodha sides. Now it is working fine.

@kool4u
Copy link

kool4u commented Jul 29, 2021

I'm also not able to connect to ticker.
@luckyIITR How did you fix it?

@luckyIITR
Copy link

enc_token is modified only for kite ticker.

enc_token = enc_token.replace("+", "%2B")
enc_token = enc_token.replace("/", "%2F")
enc_token = enc_token.replace("=", "%3D")

This worked for me.

@kool4u
Copy link

kool4u commented Jul 30, 2021

Which KiteConnect version are you using?
Is this change to be done for older version or 2.9.2?

I modified this method as per your suggestion, still not working.

def ticker(self, api_key='kitefront', enctoken=None, userid=None):

    if enctoken is not None:
        self.enctoken = self.r.cookies['enc_token']
    if userid is not None:
        self.user_id = self.user_id
    if self.user_id is None:
        raise Exception("\nCould not find the session, Please start a session using \n\n$ jtrader zerodha startsession")
        
    enc_token = self.enc_token.replace("+", "%2B")
    enc_token = enc_token.replace("/", "%2F")
    enc_token = enc_token.replace("=", "%3D")
    
    return KiteTicker(api_key=api_key, access_token=enc_token+'&user_id='+self.user_id, root='wss://ws.zerodha.com')

@ssheikh098
Copy link

ssheikh098 commented Aug 23, 2021

Its working for me.. I just updated Kite to latest version without any modification to enc_token.

def on_ticks(ws, ticks):
# Callback to receive ticks.
print(ticks)
#print(kws.is_connected())
logging.debug("Ticks: {}".format(ticks))

def on_connect(ws, response):
# Callback on successful connect.
# Subscribe to a list of instrument_tokens (RELIANCE and ACC here).
ws.subscribe([738561])

# Set RELIANCE to tick in `full` mode.
ws.set_mode(ws.MODE_FULL, [738561])

def on_close(ws, code, reason):
# On connection close stop the event loop.
# Reconnection will not happen after executing ws.stop()
ws.stop()

##Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close

##Infinite loop on the main thread. Nothing after this will run.
##You have to use the pre-defined callbacks to manage subscriptions.
kws.connect()

code copied from here.. it was not displaying anything initially so for testing i have directed printed ticks parameter..
https://kite.trade/docs/pykiteconnect/v3/ticker.m.html

@smilinrobin
Copy link

@ssheikh098
@luckyIITR
How is ticker working for you guys ?
I am getting below error :
Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (400 - BadRequest))

@luckyIITR
Copy link

@smilinrobin
For me, it is working fine.
Keep in mind that if you disconnect the ticker once, you need to restart the kernel to start ticker again.

@vishalpatil
Copy link

vishalpatil commented Dec 20, 2021

@luckyIITR which version of KiteConnect are you using. Its not working on mine 3.8.2

$ pip3 list | grep kiteconnect
kiteconnect 3.8.2

@vishalpatil
Copy link

vishalpatil commented Dec 20, 2021

Solved this by installing jugaad-trader from source. For some reason installation using pip doesn't work.
May be there might be a need for version upgrade as the upgrade command doesn't work and I see the old source in the pip installation.

Steps followed:

  1. Clone from github
  2. cd to directory
  3. Installed using python3 setup.py install --prefix /home/user/.local/

@ashishanand7
Copy link

this issue persists. i tried to fix but going nowhere.

@ssheikh098
Copy link

ssheikh098 commented Jul 31, 2022

@ashishanand7

if this has not resolved, then try these steps - #44 (comment)

this issue persists. i tried to fix but going nowhere.

@PrajwalShenoy
Copy link

Refer to this issue. This solution worked for me
#44 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants