WEBSOCKET LOGIN
-
HI @bhagvan-surani try below piece of code
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()
-
@admin aolredi wo karke dekha
-
HI @bhagvan-surani please install all the lib again..And try to import.
-
@admin ImportError: cannot import name 'WebSocket' from 'smartapi' pls help
-
Hi @Nawalagarwal we tried reaching out but no one is answering.
-
@admin email-agarwalnawal930@gmail.com
contactno.- 8709804138 -
Hi @Nawalagarwal please provide us your contact detail to help you.
-
@Nawalagarwal
Admin may help you there. -
@djdenish Thnaks the error got removed.
But now it is showing heartbeats
failed -
@Nawalagarwal
Open cmd and type : pip install Twisted
Press Enter.
Make sure you have working internet connection.