Navigation

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

    milli

    @milli

    SmartAPI Group

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

    milli Follow
    SmartAPI Group

    Best posts made by milli

    This user hasn't posted anything yet.

    Latest posts made by milli

    • RE: Important Update: Individual Order Status API using Unique Order ID (10 Requests/Second)

      @admin

      Is there a comparable function that can be directly called ref. python api to get the order status ?

      thanks

      posted in General Discussion
      M
      milli
    • RE: Ticker data always returns ticker data: [{"msg":"hb","task":"hb","ak":"nk"}]

      @vh1ne

      I get these

      Ticks: [{'ak': 'nk', 'msg': 'hb', 'task': 'hb'}]
      
      posted in NodeJS SDK
      M
      milli
    • Help regarding Websocket code

      Hello,

      I am new to SmartApi. I got the code below from GitHub

      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()
      
      
      ####### Websocket sample code ended here #######
      
      

      and

      
      ####### Websocket V2 sample code #######
      
      from SmartApi.smartWebSocketV2 import SmartWebSocketV2
      from logzero import logger
      
      AUTH_TOKEN = "Your Auth_Token"
      API_KEY = "Your Api_Key"
      CLIENT_CODE = "Your Client Code"
      FEED_TOKEN = "Your Feed_Token"
      correlation_id = "abc123"
      action = 1
      mode = 1
      token_list = [
          {
              "exchangeType": 1,
              "tokens": ["26009"]
          }
      ]
      sws = SmartWebSocketV2(AUTH_TOKEN, API_KEY, CLIENT_CODE, FEED_TOKEN)
      
      def on_data(wsapp, message):
          logger.info("Ticks: {}".format(message))
          # close_connection()
      
      def on_open(wsapp):
          logger.info("on open")
          sws.subscribe(correlation_id, mode, token_list)
      
      def on_error(wsapp, error):
          logger.error(error)
      
      def on_close(wsapp):
          logger.info("Close")
      
      def close_connection():
          sws.close_connection()
      
      
      # Assign the callbacks.
      sws.on_open = on_open
      sws.on_data = on_data
      sws.on_error = on_error
      sws.on_close = on_close
      
      sws.connect()
      
      

      I have a few questions:

      1. From where can I get the FEED_TOKEN ?
      2. For the newer version, from where can I get AUTH_TOKEN and FEED_TOKEN ?

      Thanks in advance.

      posted in Python SDK
      M
      milli