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

Web socket not working #18

Open
cvsk123 opened this issue Mar 29, 2022 · 10 comments
Open

Web socket not working #18

cvsk123 opened this issue Mar 29, 2022 · 10 comments

Comments

@cvsk123
Copy link

cvsk123 commented Mar 29, 2022

Hi, I am trying to use client.subscribe method, but its giving an error that this method is not available.
please guide.
Thank you

@jayakarthik-devices
Copy link

@cvsk123
I too got the same error when initially tried. The reason is previously i had installed the api from osparamatrix github. Then i uninstalled the api and again installed the api from this github paramatrixtech and it worked fine.

See if it works after uninstalling the api and installing it again from paramatrixtech github link.

@cvsk123
Copy link
Author

cvsk123 commented Mar 30, 2022

@jayakarthik-devices
I tried to install it from this package, but now getting some warnings and this error. Token not found.
image

@cvsk123
Copy link
Author

cvsk123 commented Mar 30, 2022

@jayakarthik-devices
could you share a sample code you are using? I am getting errors and am unable to use it.

@jayakarthik-devices
Copy link

@cvsk123
I use the below code and it works.

import ks_api_client
from ks_api_client import ks_api

def kotak_session_login():
kotak_ip = '127.0.0.1'
kotak_appId = 'DefaultApplication'
user_id = ''
user_pwd = '
'
consumer_key = ''
consumer_secret = '
'
access_token = ''
access_code = '
'
host = "https://tradeapi.kotaksecurities.com/apim"

try:
    client = ks_api.KSTradeApi(access_token = access_token, userid = user_id, \
                           consumer_key = consumer_key, ip = kotak_ip, app_id = kotak_appId, \
                           host = host, consumer_secret = consumer_secret)
                           
except Exception as e:
    print("Exception when calling SessionApi->KSTradeApi: %s\n" % e)

try:
    # Login using password
    client.login(password = user_pwd)
except Exception as e:
    print("Exception when calling SessionApi->login: %s\n" % e)

try:
    # Generate final Session Token
    client.session_2fa(access_code = access_code)
except Exception as e:
    print("Exception when calling SessionApi->session_2fa: %s\n" % e)
    
ktk_client = client

return(ktk_client)

def data_streaming(message):
print(message)

if name=="main":

ktk_client = kotak_session_login()

token_string = '11721'
status = ktk_client.subscribe(input_tokens=token_string,callback=data_streaming)

@jayakarthik-devices
Copy link

jayakarthik-devices commented Apr 1, 2022

@cvsk123
some distortion in copy paste of code in above comment. So pasted the code in a text file. Replace ***** with actual values.

test1.txt
.

@dhwajsinghal
Copy link
Contributor

are you getting the token issue with this token alone, or with any token you try to use?

@cvsk123
Copy link
Author

cvsk123 commented Apr 13, 2022

@cvsk123 some distortion in copy paste of code in above comment. So pasted the code in a text file. Replace ***** with actual values.

test1.txt .

Still Same Issue with this code also
image

@cvsk123
Copy link
Author

cvsk123 commented Apr 13, 2022

are you getting the token issue with this token alone, or with any token you try to use?

For every token i am getting this error

@cvsk123
Copy link
Author

cvsk123 commented Apr 13, 2022

@paramatrixtech could you please guide me on this issue.

@KESHAV48
Copy link

KESHAV48 commented Aug 7, 2022

@cvsk123 some distortion in copy paste of code in above comment. So pasted the code in a text file. Replace ***** with actual values.
test1.txt .

Still Same Issue with this code also image
even i'm facing the same issue for below piece of code
image

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

4 participants