Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. parth3737
    P
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Groups 0

    parth3737

    @parth3737

    0
    Reputation
    2
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    parth3737 Unfollow Follow

    Latest posts made by parth3737

    • RE: Migrate my code in Smart API

      Why everyone is asking for migration in forum?

      posted in General Discussion
      P
      parth3737
    • Websocket Data Issue

      Hello,

      Is the below code correct? As I am not getting tick data for SBI.
      Can someone help?

      token="mcx_fo|224395"
      token="nse_cm|3045" #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(feedToken, clientId)

      def on_message(ws, message):
      print("Ticks: {}".format(message))
      print(message)
      def on_open(ws,response):
      print("on open")
      ws.subscribe(task,token)

      def on_error(ws, error):
      print(error)

      def on_close(ws):
      print("Close")
      ws.stop()

      ss._on_open = on_open
      ss._on_message = on_message
      ss._on_error = on_error
      ss._on_close = on_close

      ss.connect()

      Output is below:

      [{'name': 'tm', 'tvalue': '02/07/2021 20:03:04'}]
      Ticks: [{'name': 'tm', 'tvalue': '02/07/2021 20:03:05'}]
      [{'name': 'tm', 'tvalue': '02/07/2021 20:03:05'}]
      Ticks: [{'name': 'tm', 'tvalue': '02/07/2021 20:03:06'}]
      [{'name': 'tm', 'tvalue': '02/07/2021 20:03:06'}]

      posted in Python SDK
      P
      parth3737