Navigation

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

    Posts made by nahas_n

    • RE: unable to login - SSLError

      certificate issue . unable to get token. please rectify issue asap

      posted in Python SDK
      N
      nahas_n
    • RE: getting the next expiry dates

      just save the dates ones for a year. and read the above from text file and compare with today date. and choose the near one. u only need to update once in a year.

      posted in General Discussion
      N
      nahas_n
    • Options data is not streaming today in websocket

      hey today options not streaming with websocket. no problem with other stocks or future. please check from ur backend

      posted in Bugs
      N
      nahas_n
    • NSE index feed NIFTY and BANKNIFTY along with other scrip

      hey index (NIFTY and BANKNIFTY ) index feeding through websocket with a task of "mw"

      nse_cm|26009 is for BankNifty..
      nse_cm|26000 is for Nifty..
      

      this is thing is super slow. i am getting tick with speed of 10 sec per tick. for index. no issues with stocks. any other way to get the index feed faster way ? . no documentation for streaming stock data along with index data. Any body solve this issue ?

      posted in General Discussion
      N
      nahas_n
    • RE: Error info: Connection to remote host was lost. Connection to remote host was lost.

      @admin the problem still exists. i have log . i have took the count how many time it got disconnected . which is 42 time. please fix the problem as soon as possible.

      posted in General Discussion
      N
      nahas_n
    • RE: Error info: Connection to remote host was lost. Connection to remote host was lost.
      from smartapi import SmartWebSocket
      import pickle
      from smartapi import SmartConnect
      from time import sleep
      from datetime import datetime as dt
      
      
      def get_feedtoken ():
          file = f'cache/ft_{dt.now().strftime("%d_%m_%Y")}.cache'
          token = pickle.load(open(file , 'rb') )
          return [( k , v ) for k, v in token.items() ][0]
      
      
      def on_message(ws, message):
          global count , token , ts
          try:
              # print(message)
              for msg in message:
                  ts['timestamp'] = msg['tvalue'] if 'tvalue' in msg.keys() else ts['timestamp']
                  msg['ltt'] = ts['timestamp'] if 'ltt' in msg.keys() and msg['ltt']=='NA' else msg['ltt']
                  if not 'tvalue' in msg.keys():
                      msg.update(ts)
                      print(msg)
          except Exception as e:
              traceback.print_exc()
              exit()
      
      def on_open(ws):
          global task , token
          print("on open")
          ss.subscribe(task,token)
          print("subscribed")
      
      def on_error(ws, error):
          print(error)
      
      def on_close(ws):
          print("Close")
      
      
      CLIENT_CODE ,FEED_TOKEN   = get_feedtoken ()
      token="nse_cm|26009"
      task="mw"   # mw|sfi|dp
      ts = {'timestamp' : None }
      ss = SmartWebSocket(FEED_TOKEN, CLIENT_CODE)
      ss._on_open = on_open
      ss._on_message = on_message
      ss._on_error = on_error
      ss._on_close = on_close
      
      while True:
          ss.connect()
      
      

      some guys are dm me about to code. for handling about such scenario. this egs works fine. u need to reconnect again when it disconnected. no other options

      posted in General Discussion
      N
      nahas_n
    • RE: TOKEN WITH SYMBOL

      @ankur12 try task as "mw" even if it is index. it will work along with other symbols

      posted in Python SDK
      N
      nahas_n
    • RE: websocket down ?

      @admin the connection drop problem still exists that i have reported earlier. but i have managed to reconnect . please clear that from ur end.

      posted in General Discussion
      N
      nahas_n
    • RE: websocket down ?

      @admin all nifty 50 symbols

      posted in General Discussion
      N
      nahas_n
    • RE: websocket down ?

      @admin python

      posted in General Discussion
      N
      nahas_n
    • RE: websocket down ?

      @admin There was bug in my code. i fixed. worked like charm 👍👍👍

      posted in General Discussion
      N
      nahas_n
    • websocket down ?

      today websocket down ?

      posted in General Discussion
      N
      nahas_n
    • RE: TOKEN WITH SYMBOL

      @ankur12

      nse_cm|26009 is for BankNifty..
      nse_cm|26000 is for Nifty..
      
      posted in Python SDK
      N
      nahas_n
    • RE: Can I get option historical data from other resources and use it with smartAPI ?

      @athul_4554 truedata .

      posted in General Discussion
      N
      nahas_n
    • RE: getting error in websocket

      @rajanprabu their library is painful .

      def connect_ws ():
          while True:
              ss.connect()
      

      use like this instead of

       thread.start_new_thread(connect_ws, ())
      
      

      if u dont have any other things going on . just call connect function in a while loop . the problem getting solved.

      posted in Python SDK
      N
      nahas_n
    • RE: getting error in websocket

      @pt4rh is this error obtained while u connecting to ur flask server or .. ?
      put ss.connect() in while True loop. their webscoket connection is disconnected somehwhere around 1500 tick streaming. if its disconnected then u need to ss.connect(). .
      i have over come this problem by this. and websocket connection to angel is running on separate thread . and tick accessing with queue and processing.

      posted in Python SDK
      N
      nahas_n
    • RE: websocket

      @rajanprabu thanks brother

      posted in Python SDK
      N
      nahas_n
    • websocket

      how to subscribe index feed in websocket ?
      what is the format for symbol token ? i dont find such information in documentation.

      for fno its like nse_fo| symbol_token . for index ?

      posted in Python SDK
      N
      nahas_n
    • Error info: Connection to remote host was lost. Connection to remote host was lost.

      websocket disconnected after some time.

      for egs

      {'ap': '34984.60', 'bp': '35135.05', 'bq': '75', 'bs': '100', 'c': '34929.35', 'cng': '212.55', 'e': 'nse_fo', 'lo': '34830.00', 'ltp': '35141.90', 'ltq': '25', 'ltt': '10/06/2021 13:19:58', 'name': 'sf', 'nc': '00.6085', 'sp': '35141.95', 'tbq': '149400', 'tk': '48506', 'to': '60974659340.00', 'tsq': '108200', 'v': '1742900'}
      326
      Error info: Connection to remote host was lost.
      Connection to remote host was lost.
      

      please check the issues in the server side.

      posted in General Discussion
      N
      nahas_n
    • RE: Dynamic symbol change for websocket

      @admin Connecting to the WebSocket endpoint
      The WebSocket URL is:

      wss://omnefeeds.angelbroking.com/NestHtml5Mobile/socket/stream

      The WebSocket endpoint is wss:// omnefeeds.angelbroking.com. To establish a connection, you have to pass two query parameters, CLIENT_CODE and FEED_TOKEN.

      Note:-
      1 There will be all input parameter sent in JSON format for all type of task.
      2 To stop (unsubscribe) script feed you need to send “channel” parameter in input JSON object as blank string.
      3 To stop (unsubscribe) index feed you need to send “channel” parameter in input JSON object as blank string.
      4 To start (subscribe) feed (index/script)you need to send input JSON object with “channel” value as mentioned in document
      5 Index Feed : If ampersand (&) value exists in index value , need to replace with exclamatory symbol (!). Eg : bse_cm|BSE Oil&Gas to be sent as bse_cm|BSE
      6 Script feed : for task mw after the acknowledge response, we provide certain script details from mrv which is not available in regular feed , sample is given below :

      code_text
      ```[{"ak":"ok","task":"mw","msg":"mw"}]
      [{"lo":"1797.55","ts":"ACC-EQ","tp":null,"ltp":"1800.05","ltq":"27","bs":"16","tk":"22","ltt":"31\/08\/2017 11:32:01",
      "lcl":null,"tsq":"76435","cng":"-11.15","bp":"1800.00","bq":"510","mc":"34012.01277(Crs)","isdc":"18.77872
      (Crs)","name":"sf","tbq":"76497","oi":null,"yh":"1801.25","e":"nse_cm","sp":"1800.90","op":"1814.00","c": "1811.20",
      "to":"145093696.35","ut":"31-Aug-2017 11:32:01","h":"1817.55","v":"80391","nc":"- 00.62","ap":"1804.85","yl":"1800.00","ucl":null,"toi":"16654000" }]
      

      7 Where added JSONArray with each JSONObject (each sf ) holding mrv script details given in ‘channel’
      Even for Depth feed ( task – dp) as well as index feed ( task – sfi) , we have added first mrv data in response, where field list are same as listed under regular feed response table.

      This is from the documentation. but in python library it is not implemented till yet. any way let proceed this discussion with github 👍

      posted in Python SDK
      N
      nahas_n