Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    WEBSOCKET LOGIN

    Python SDK
    4
    14
    112
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      Nawalagarwal last edited by

      Exception has occurred: ImportError
      cannot import name 'ensureDeferred' from 'twisted.internet.defer' (C:\Users\User\anaconda3\lib\site-packages\twisted\internet\defer.py)
      File "C:\Users\User\Favorites\websocket.py", line 1, in <module>
      from smartapi import WebSocket

      D 1 Reply Last reply Reply Quote 0
      • D
        djdenish @Nawalagarwal last edited by djdenish

        @Nawalagarwal
        Open cmd and type : pip install Twisted
        Press Enter.
        Make sure you have working internet connection.

        N 1 Reply Last reply Reply Quote 0
        • N
          Nawalagarwal @djdenish last edited by

          @djdenish Thnaks the error got removed.
          But now it is showing heartbeats
          failed

          D A 2 Replies Last reply Reply Quote 0
          • D
            djdenish @Nawalagarwal last edited by

            @Nawalagarwal
            Admin may help you there.

            1 Reply Last reply Reply Quote 0
            • A
              admin @Nawalagarwal last edited by

              Hi @Nawalagarwal please provide us your contact detail to help you.

              N B 2 Replies Last reply Reply Quote 0
              • N
                Nawalagarwal @admin last edited by

                @admin email-agarwalnawal930@gmail.com
                contactno.- 8709804138

                A 1 Reply Last reply Reply Quote 0
                • A
                  admin @Nawalagarwal last edited by

                  Hi @Nawalagarwal we tried reaching out but no one is answering.

                  1 Reply Last reply Reply Quote 0
                  • B
                    bhagvan surani @admin last edited by

                    @admin ImportError: cannot import name 'WebSocket' from 'smartapi' pls help

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      admin @bhagvan surani last edited by

                      HI @bhagvan-surani please install all the lib again..And try to import.

                      B 1 Reply Last reply Reply Quote 0
                      • B
                        bhagvan surani @admin last edited by

                        @admin aolredi wo karke dekha

                        A 1 Reply Last reply Reply Quote 0
                        • A
                          admin @bhagvan surani last edited by

                          HI @bhagvan-surani try below piece of code
                          from smartapi import SmartWebSocket

                          feed_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_close

                          ss.connect()

                          B 1 Reply Last reply Reply Quote 0
                          • B
                            bhagvan surani @admin last edited by

                            @admin said in WEBSOCKET LOGIN:

                            SmartWebSocket

                            SmartWebSocket isme work kartahe lekin usme bid, asx, ltp kush nahi he aese data aaraha he

                            {'task': 'cn', 'channel': 'NONLM', 'token': '0987690212', 'user': 'B42868', 'acctid': 'B42868'}
                            2021-06-11 13:07:55.160956 : Start task in the background
                            {'task': 'hb', 'channel': '', 'token': '0987690212', 'user': 'B42868', 'acctid': 'B42868'}

                            A 1 Reply Last reply Reply Quote 0
                            • A
                              admin @bhagvan surani last edited by

                              HI @bhagvan-surani Our team is working on websocket we will update you on this.

                              B 1 Reply Last reply Reply Quote 0
                              • B
                                bhagvan surani @admin last edited by

                                @admin thanks.

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post