Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. Manoj Kathare
    3. Posts
    M
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by Manoj Kathare

    • RE: Facing problem when streaming the live data

      It's working now I had given the wrong API key
      please check the API key once @nayan_nandi

      posted in General Discussion
      M
      Manoj Kathare
    • RE: Facing problem when streaming the live data

      WebSocket

      from smartapi import SmartConnect
      from smartapi import WebSocket
      obj=SmartConnect(api_key="my_key")
      data = obj.generateSession('Client_id', 'Pass')
      feedToken=obj.getfeedToken()
      FEED_TOKEN=feedToken
      CLIENT_CODE="Client_id"
      token="nse_cm|2885" #"nse_cm|2885&nse_cm|1594&nse_cm|11536"
      task="dp" #"mw"|"sfi"|"dp"
      ss = WebSocket(FEED_TOKEN, CLIENT_CODE)

      def on_tick(ws, tick):
      print("Ticks: {}".format(tick))

      def on_connect(ws, response):
      ws.websocket_connection() # Websocket connection
      ws.send_request(token,task)

      def on_close(ws, code, reason):
      ws.stop()

      Assign the callbacks.

      ss.on_ticks = on_tick
      ss.on_connect = on_connect
      #ss.on_close = on_close

      ss.connect()
      print(tick)

      posted in General Discussion
      M
      Manoj Kathare
    • RE: Facing problem when streaming the live data

      @nayan_nandi I am also facing the same problem
      if it is fixed on your side please let me know

      posted in General Discussion
      M
      Manoj Kathare