Kotak-Neo / kotak-neo-api

112 stars 103 forks source link

Subscribe to orderfeed function not working #140

Open sid201288 opened 7 months ago

sid201288 commented 7 months ago

Whenevr I have tried to subscribe order feed this error displays: TypeError: subscribe_to_orderfeed() missing 3 required positional arguments: 'on_message', 'on_close', and 'on_error' Please give any solution.

abimk9 commented 7 months ago

Check docs/webSocket.md

hardikpatel043 commented 7 months ago

same issue for me after upgrading 1.2.0

hardikpatel043 commented 7 months ago

self.client = NeoAPI(consumer_key=self.consumer_key, consumer_secret=self.consumer_secret, environment=self.environment) self.client.on_message = self.on_message self.client.on_error = self.on_error self.client.on_close = self.on_close self.client.on_open = self.on_open

This should work with 1.2.0

crypt0inf0 commented 7 months ago

@hardikpatel043 We can not use custom call back function like we did on client.subscribe_to_orderfeed(custom_cb, on_close, on_error) using the 1.2.1, Is there any workaround? Using client.on_message = custom_cb is set as a default for all call backs. How to individually set custom call backs for order feed, LTP, etc...

Hardik131 commented 7 months ago

@hardikpatel043 , @abimk9 , @crypt0inf0 can you guys please help with this ? I am getting this {'type': 'order_feed', 'data': '{"ak":"nk","type":"cn","task":"cn","msg":"Authentication Failed"}'}

after subscribing to subscribe_to_orderfeed api.

i have checked that all other apis are working fine. here is how i am logging in

import pandas as pd
import threading
import time
from pprint import pprint
from neo_api_client import NeoAPI
from datetime import datetime

consumerKey = "xxxx"
secretKey = "xxxx"
loginPwd = "xxxx"
mobileNumber = "xxxx"
client = NeoAPI(consumer_key=consumerKey, consumer_secret=secretKey,
                environment='prod')

pprint(client.login(mobilenumber=mobileNumber, password=loginPwd))
pprint(client.session_2fa("xxxx"))
crypt0inf0 commented 7 months ago

@Hardik131 On client.session_2fa("xxxx") enter your mpin

Hardik131 commented 7 months ago

@Hardik131 On client.session_2fa("xxxx") enter your mpin

Yes i have been using mpin only. Without mpin other apis won't work but in my case other apis are working fine

rupanshugoyal commented 6 months ago

getting the same "Authentication Failed" error on subscribe_to_orderfeed api. anybody found any fix for the same ?

manojkumar5251 commented 3 months ago

getting the same "Authentication Failed" error on subscribe_to_orderfeed api. anybody found any fix for the same ?

@hardikpatel043 , @abimk9 , @crypt0inf0 can you guys please help with this ? I am getting this {'type': 'order_feed', 'data': '{"ak":"nk","type":"cn","task":"cn","msg":"Authentication Failed"}'}

after subscribing to subscribe_to_orderfeed api.

i have checked that all other apis are working fine. here is how i am logging in

import pandas as pd
import threading
import time
from pprint import pprint
from neo_api_client import NeoAPI
from datetime import datetime

consumerKey = "xxxx"
secretKey = "xxxx"
loginPwd = "xxxx"
mobileNumber = "xxxx"
client = NeoAPI(consumer_key=consumerKey, consumer_secret=secretKey,
                environment='prod')

pprint(client.login(mobilenumber=mobileNumber, password=loginPwd))
pprint(client.session_2fa("xxxx"))

Change the ORDER_FEED_URL in neo_api_client/urls.py wss://mlhsi.kotaksecurities.com/realtime?sId= -> wss://mdlhsi.kotaksecurities.com/realtime?sId=

crypt0inf0 commented 3 months ago

getting the same "Authentication Failed" error on subscribe_to_orderfeed api. anybody found any fix for the same ?

@hardikpatel043 , @abimk9 , @crypt0inf0 can you guys please help with this ? I am getting this {'type': 'order_feed', 'data': '{"ak":"nk","type":"cn","task":"cn","msg":"Authentication Failed"}'} after subscribing to subscribe_to_orderfeed api. i have checked that all other apis are working fine. here is how i am logging in

import pandas as pd
import threading
import time
from pprint import pprint
from neo_api_client import NeoAPI
from datetime import datetime

consumerKey = "xxxx"
secretKey = "xxxx"
loginPwd = "xxxx"
mobileNumber = "xxxx"
client = NeoAPI(consumer_key=consumerKey, consumer_secret=secretKey,
                environment='prod')

pprint(client.login(mobilenumber=mobileNumber, password=loginPwd))
pprint(client.session_2fa("xxxx"))

Change the ORDER_FEED_URL in neo_api_client/urls.py wss://mlhsi.kotaksecurities.com/realtime?sId= -> wss://mdlhsi.kotaksecurities.com/realtime?sId=

Were did you get this URL wss://mdlhsi.kotaksecurities.com/realtime?sId= from? Its not working for me.

manojkumar5251 commented 3 months ago

getting the same "Authentication Failed" error on subscribe_to_orderfeed api. anybody found any fix for the same ?

@hardikpatel043 , @abimk9 , @crypt0inf0 can you guys please help with this ? I am getting this {'type': 'order_feed', 'data': '{"ak":"nk","type":"cn","task":"cn","msg":"Authentication Failed"}'} after subscribing to subscribe_to_orderfeed api. i have checked that all other apis are working fine. here is how i am logging in

import pandas as pd
import threading
import time
from pprint import pprint
from neo_api_client import NeoAPI
from datetime import datetime

consumerKey = "xxxx"
secretKey = "xxxx"
loginPwd = "xxxx"
mobileNumber = "xxxx"
client = NeoAPI(consumer_key=consumerKey, consumer_secret=secretKey,
                environment='prod')

pprint(client.login(mobilenumber=mobileNumber, password=loginPwd))
pprint(client.session_2fa("xxxx"))

Change the ORDER_FEED_URL in neo_api_client/urls.py wss://mlhsi.kotaksecurities.com/realtime?sId= -> wss://mdlhsi.kotaksecurities.com/realtime?sId=

Were did you get this URL wss://mdlhsi.kotaksecurities.com/realtime?sId= from? Its not working for me.

working for me did you change it in the neo_api_client/urls.py ?

rupanshugoyal commented 3 months ago

getting the same "Authentication Failed" error on subscribe_to_orderfeed api. anybody found any fix for the same ?

@hardikpatel043 , @abimk9 , @crypt0inf0 can you guys please help with this ? I am getting this {'type': 'order_feed', 'data': '{"ak":"nk","type":"cn","task":"cn","msg":"Authentication Failed"}'} after subscribing to subscribe_to_orderfeed api. i have checked that all other apis are working fine. here is how i am logging in

import pandas as pd
import threading
import time
from pprint import pprint
from neo_api_client import NeoAPI
from datetime import datetime

consumerKey = "xxxx"
secretKey = "xxxx"
loginPwd = "xxxx"
mobileNumber = "xxxx"
client = NeoAPI(consumer_key=consumerKey, consumer_secret=secretKey,
                environment='prod')

pprint(client.login(mobilenumber=mobileNumber, password=loginPwd))
pprint(client.session_2fa("xxxx"))

Change the ORDER_FEED_URL in neo_api_client/urls.py wss://mlhsi.kotaksecurities.com/realtime?sId= -> wss://mdlhsi.kotaksecurities.com/realtime?sId=

Were did you get this URL wss://mdlhsi.kotaksecurities.com/realtime?sId= from? Its not working for me.

the fix is not working for me either. @manojkumar5251 still getting the same error.

can you please explain further.

adityaparakh1 commented 3 months ago

Same Error.

Price Feeds / Order Placement etc are all working fine.

rajendrasp commented 3 months ago

I am also getting the same error. Did you get the resolution for this?

{'type': 'order_feed', 'data': '{"ak":"nk","type":"cn","task":"cn","msg":"Authentication Failed"}'}

manojkumar5251 commented 3 months ago

Try installing the package with this command

pip install "git+https://github.com/manojkumar5251/kotak-neo-api.git#egg=neo_api_client"

till the PR is approved

rajendrasp commented 2 months ago

I tried editing the "urls.py" file but it is still giving me same error.

        self.kotakneo.session_2fa(OTP=accessCode)
        self.kotakneo.on_message = on_message_stock  # called when message is received from websocket
        self.kotakneo.on_error = on_error  # called when any error or exception occurs in code or websocket
        self.kotakneo.on_close = on_close  # called when websocket connection is closed
        self.kotakneo.on_open = on_open  # called when websocket successfully connects

        self.kotakneo.subscribe_to_orderfeed()

It seems that it is not working for others also. Can you pls verify it?

sarvadaman51 commented 2 months ago

I am facing the same issue. Also url change does not fix the issue

sarvadaman51 commented 2 months ago

Can someone please suggest the workaround or fix for the issue?

Hardik131 commented 2 months ago

getting the same "Authentication Failed" error on subscribe_to_orderfeed api. anybody found any fix for the same ?

@hardikpatel043 , @abimk9 , @crypt0inf0 can you guys please help with this ? I am getting this {'type': 'order_feed', 'data': '{"ak":"nk","type":"cn","task":"cn","msg":"Authentication Failed"}'} after subscribing to subscribe_to_orderfeed api. i have checked that all other apis are working fine. here is how i am logging in

import pandas as pd
import threading
import time
from pprint import pprint
from neo_api_client import NeoAPI
from datetime import datetime

consumerKey = "xxxx"
secretKey = "xxxx"
loginPwd = "xxxx"
mobileNumber = "xxxx"
client = NeoAPI(consumer_key=consumerKey, consumer_secret=secretKey,
                environment='prod')

pprint(client.login(mobilenumber=mobileNumber, password=loginPwd))
pprint(client.session_2fa("xxxx"))

Change the ORDER_FEED_URL in neo_api_client/urls.py wss://mlhsi.kotaksecurities.com/realtime?sId= -> wss://mdlhsi.kotaksecurities.com/realtime?sId=

Were did you get this URL wss://mdlhsi.kotaksecurities.com/realtime?sId= from? Its not working for me.

the fix is not working for me either. @manojkumar5251 still getting the same error.

can you please explain further.

Modifying in urls.py worked for me. Don't forget to compile urls.py after modifying, that could be one of the reason for not working.

Hardik131 commented 2 months ago

I am facing the same issue. Also url change does not fix the issue

Did you run urls.py after modifying?

crypt0inf0 commented 2 months ago

Using the wss://mdlhsi.kotaksecurities.com/realtime?sId= I get the auth error but rest of the api works fine like positions and trade report, etc...

The Session has been Opened!
{'type': 'order_feed', 'data': '{"ak":"nk","type":"cn","task":"cn","msg":"Authentication Failed"}'}
Haeckerzz commented 1 month ago

urls

Same happeing with me

I am facing this issue with kotak neo only for subscribe_to_orderfeed

CODE-> client.subscribe_to_orderfeed()

Error->

'type': 'order_feed', 'data': '{"ak":"nk","type":"cn","task":"cn","msg":"Authentication Failed"}'}

but here comes the twist all other api are working with accurate data like order_report, positions, etc.

Hardik131 commented 1 month ago

Modifying url worked for me, but it worked only in one account. My brother also has account in kotak i tried to run code in his account and it failed. I think it is related to the account not code. When i login through my account in response i am getting that mfaccess : 2 but in my brother's account mfaccess : 1. maybe this is happening because in some accounts they don't give enough access.

Please let me know if anyone has any idea about mfaccess.

sid8489 commented 5 days ago

Pls Try changing url to wss://clhsi.kotaksecurities.com/realtime . Saw it in there Public App.