HeartBeats Failed
-
@PandaTrade said in HeartBeats Failed:
Also even after the program has ended the heartbeat failed message keeps popping up.
Thats mainly because Heartbeart connection is running in separate thread. I have a parallel script running to check if there is any HB failure message. Once it find it will stop and restart the script. Of course this can be a issue if you use indicators using past data.
-
hi @admin
have you fixed your Tickdata web socket code?
To me it looks like working. Just want to confirm what are the fixes that you have done? -
They released a new SDK.. But yet to try it.. will try in the evening with MCX data.
-
@rajanprabu btw how do you update your sdk that you had downloaded already..
Could you point me to it. -
@PandaTrade pip install websocket-client
i guess this should do it -
HI @PandaTrade uninstall and install again.
-
pip install smartapi-python --upgrade
should in general upgrade to latest version even if you have it installed already..
-
HeartBeats Failed
HeartBeats Failed@admin i am still getting such messages.
Isn't the program supposed to work infinetely?
For me it got ended in 5 mins. -
-
@rajanprabu yes
-
Thats sad :(. Thanks for testing..
-
Hi @admin,
from smartapiwebsocket import SmartWebSocket
This is the import that is given in the examples section of github.
When i try to use this it doesn't work.Could you let me know what are the imports that i need to do?
FYI, earlier used thisfrom smartapi import WebSocket;from smartapi import SmartConnect
-
Hi @PandaTrade from smartapi import SmartWebSocket
-
2021-06-01 10:55:23.634091 : Start task in the background {'task': 'hb', 'channel': '', 'token': '092017127', 'user': 'X63314', 'acctid': 'X63314'}``` hello @admin, I am not getting tick data except the above response. could you please paste your sample code for the same.
-
@admin any update on this?
@rajanprabu are you able to test websocket streaming?
-
Hi @PandaTrade can you mail us your request and response.
-
Im using an older SDK for production. Didnt get time to test the new one. But I face Heartbeat failure message twice today.
-
Hi @rajanprabu try with this example its already available in read me file kindly update your sdk to 1.2.7.
from smartapi import SmartWebSocketfeed_token=092017047
FEED_TOKEN="YOUR_FEED_TOKEN"
CLIENT_CODE="YOUR_CLIENT_CODE"token="mcx_fo|224395"
token="EXCHANGE|TOKEN_SYMBOL" #SAMPLE: nse_cm|2885&nse_cm|1594&nse_cm|11536&nse_cm|3045
token="mcx_fo|226745&mcx_fo|220822&mcx_fo|227182&mcx_fo|221599"
task="mw" # mw|sfi|dp
ss = SmartWebSocket(FEED_TOKEN, CLIENT_CODE)
def on_message(ws, message):
print("Ticks: {}".format(message))def on_open(ws):
print("on open")
ss.subscribe(task,token)def on_error(ws, error):
print(error)def on_close(ws):
print("Close")Assign the callbacks.
ss._on_open = on_open
ss._on_message = on_message
ss._on_error = on_error
ss._on_close = on_closess.connect()
-
Taking a new SDK live is very risky ( I learned my lesson in the past ). When real money is involved I cant take any risk. I will do my testing for a week before I move this to production. When I get time I will test it..
Thanks
-
@admin
I get this status when i read the data .i.e return of the obj.generatesession
datais={'status': False, 'message': 'User Is Blocked', 'errorcode': 'AB1007', 'data': None}