Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. ashigro
    3. Posts
    A
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 20
    • Best 5
    • Groups 0

    Posts made by ashigro

    • SmartWebsocket2 - If exchange type is invalid, API does not throw any error

      I thought of posting it for future improvement or helping others. Somehow, I unknowingly updated exchange type as '0' in my code and I stopped getting any streaming data. It took me a few hours to figure-out the problem after finally comparing with previous version of code.

      Documentation
      https://smartapi.angelbroking.com/docs/WebSocket2

      Following are valid exchange types:

      tokenList[].exchangeType Integer M

      exchange type

      1 (nse_cm)

      2 (nse_fo)

      3 (bse_cm)

      4 (bse_fo)

      5 (mcx_fo)

      7 (ncx_fo)

      13 (cde_fo)

      posted in Python SDK
      A
      ashigro
    • RE: Convert position error: 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004'

      @Moderator_2 , Please help. My auto trading on AngelOne is halted for months because convertPosition is not working.
      I tried with postman as well, getting same error.

      {
      "message": "Something went wrong. Please try after sometime",
      "errorcode": "AB1004",
      "status": false,
      "data": null
      }

      posted in Python SDK
      A
      ashigro
    • RE: Convert position error: 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004'

      @Moderator_2 it is consistent

      posted in Python SDK
      A
      ashigro
    • RE: Convert position error: 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004'

      @Moderator_2 It is consistent.

      posted in Python SDK
      A
      ashigro
    • RE: Convert position error: 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004'

      @Moderator_2 any update?

      posted in Python SDK
      A
      ashigro
    • RE: Wrong LTP data

      @bansal3amardeep I believe this is the case for all, even I am converting the incoming stream to decimal value in my code.

      posted in General Discussion
      A
      ashigro
    • RE: Convert position error: 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004'

      @Moderator_2
      No I have not used postman in past.
      Client code is MVY398, convert position was issued multiple times between 11:00 am - 2:00 pm, script PAYTM.

      posted in Python SDK
      A
      ashigro
    • Convert position error: 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004'

      {'message': 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004', 'status': False, 'data': None}

      dict1 = obj.position()
      for stock in dict1['data']:
          if stock['symboltoken'] == '6705':
              stock['newproducttype']: 'INTRADAY'
              print(stock)
              posParameters = {
                  "exchange": stock['exchange'],
                  "symboltoken": stock['symboltoken'],
                  "producttype": stock['producttype'],
                  "newproducttype": "INTRADAY",
                  "tradingsymbol": stock['tradingsymbol'],
                  "symbolname": stock['symbolname'],
                  "instrumenttype": stock['instrumenttype'],
                  "priceden": stock['priceden'],
                  "pricenum": stock['pricenum'],
                  "genden": stock['genden'],
                  "gennum": stock['gennum'],
                  "precision": stock['precision'],
                  "multiplier": stock['multiplier'],
                  "boardlotsize": stock['boardlotsize'],
                  "buyqty": stock['buyqty'],
                  "sellqty": stock['sellqty'],
                  "buyamount": stock['buyamount'],
                  "sellamount": stock['sellamount'],
                  "transactiontype": "BUY",
                  "quantity": quantity,
                  "type": "DAY"
              }
              status = obj.convertPosition(posParameters)
              print(status)
      
      posted in Python SDK
      A
      ashigro
    • RE: smartWebSocketV2:304] Error occurred during WebSocket connection: WebSocketApp.run_forever()

      @poorna https://github.com/angel-one/smartapi-python

      posted in Python SDK
      A
      ashigro
    • RE: smartWebSocketV2:304] Error occurred during WebSocket connection: WebSocketApp.run_forever()

      @Moderator_1 Resolved the issue by using version numbers of dependencies mentioned in git repo. It seems there is some conflict with updated versions of any of the dependency packages.

      Following requirements listed in requirements_dev.txt helped:
      attrs==23.1.0
      autobahn==23.6.2
      Automat==22.10.0
      certifi==2023.5.7
      cffi==1.15.1
      charset-normalizer==3.1.0
      constantly==15.1.0
      cryptography==41.0.5
      hyperlink==21.0.0
      idna==3.4
      incremental==22.10.0
      isodate==0.6.1
      logzero==1.7.0
      pycparser==2.21
      pyotp==2.8.0
      pyparsing==3.1.0
      python-dateutil==2.8.2
      pytz==2023.3
      rdflib==6.3.2
      rdflib-jsonld==0.6.2
      requests==2.31.0
      simplejson==3.19.1
      six==1.16.0
      Twisted==22.10.0
      txaio==23.1.1
      typing_extensions==4.6.3
      urllib3==2.0.3
      websocket-client==1.6.0
      zope.interface==6.0

      posted in Python SDK
      A
      ashigro
    • Fix smartapi-python requirements_dev.txt

      correct smartapi-python version to 1.4.5
      remove pycrypto
      correct cryptography version to >=41.0.5

      Following errors are reported if using current requirements_dev.txt

      ERROR: Could not find a version that satisfies the requirement smartapi-python==1.4.4 (from versions: 1.0.1, 1.0.2, 1.0.3, 1.0.3.1, 1.0.3.2, 1.0.3.3, 1.0.3.4, 1.0.4, 1.0.5, 1.0.5.1, 1.0.5.2, 1.0.5.3, 1.0.5.4, 1.0.5.5, 1.0.6, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.2.8, 1.2.9, 1.3.0, 1.3.1, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.4.0, 1.4.1, 1.4.5)
      ERROR: No matching distribution found for smartapi-python==1.4.4

      ERROR: Could not build wheels for pycrypto, which is required to install pyproject.toml-based projects

      ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
      pyopenssl 24.0.0 requires cryptography<43,>=41.0.5, but you have cryptography 41.0.1 which is incompatible.

      posted in Python SDK
      A
      ashigro
    • RE: smartWebSocketV2:304] Error occurred during WebSocket connection: WebSocketApp.run_forever()

      @Moderator_1 I am using latest version 1.2.5 of SmartApi-python package. Is there anything else I need to do. Strangley, same code is working fine in google colab environment.

      Could it be something to do with bug/issue with version of other package(s)?

      posted in Python SDK
      A
      ashigro
    • RE: smartWebSocketV2:304] Error occurred during WebSocket connection: WebSocketApp.run_forever()

      @admin Please help

      posted in Python SDK
      A
      ashigro
    • smartWebSocketV2:304] Error occurred during WebSocket connection: WebSocketApp.run_forever()

      [E 240226 09:00:36 smartWebSocketV2:304] Error occurred during WebSocket connection: WebSocketApp.run_forever() got an unexpected keyword argument 'ping_payload'
      Exception in thread Thread-8 (feed):
      Traceback (most recent call last):
      File "C:\Users\ashig\anaconda3\envs\trader-env\lib\threading.py", line 1016, in _bootstrap_inner
      self.run()
      File "C:\Users\ashig\anaconda3\envs\trader-env\lib\threading.py", line 953, in run
      self._target(*self._args, **self._kwargs)
      File "C:\Users\ashig\AppData\Local\Temp\ipykernel_11200\1613896697.py", line 325, in feed
      File "C:\Users\ashig\anaconda3\envs\trader-env\lib\site-packages\SmartApi\smartWebSocketV2.py", line 305, in connect
      raise e
      File "C:\Users\ashig\anaconda3\envs\trader-env\lib\site-packages\SmartApi\smartWebSocketV2.py", line 301, in connect
      self.wsapp.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}, ping_interval=self.HEART_BEAT_INTERVAL,
      TypeError: WebSocketApp.run_forever() got an unexpected keyword argument 'ping_payload'

      posted in Python SDK
      A
      ashigro
    • RE: Error in WebSocket 2.0: byte indices must be integers or slices, not str

      <Error: SmartWebSocketV2._on_close() takes 2 positional arguments but 4 were given>

      We can fix this error by updating _on_close method with additional arguments in SmartWebSocketV2.py file.

      def _on_close(self, wsapp, close_status_code, close_msg):

      This error is thrown because on_close method of websocket class takes multiple arguments which are missing in SmartWebSocket library. Example code:
      https://websocket-client.readthedocs.io/en/latest/examples.html

      posted in Python SDK
      A
      ashigro
    • RE: User Feedback - WebSocket 2.0 Beta Rollout – Python Language

      @sathyaraj
      We can fix this error by updating _on_close method with additional arguments in SmartWebSocketV2.py file.

      def _on_close(self, wsapp**, close_status_code, close_msg**):

      <Error: SmartWebSocketV2._on_close() takes 2 positional arguments but 4 were given>
      This error is thrown because on_close method of websocket class takes multiple arguments which are missing in SmartWebSocket library. Example code:
      https://websocket-client.readthedocs.io/en/latest/examples.html

      posted in Python SDK
      A
      ashigro
    • RE: Not able to connect to the websocket, please help!

      @Moderator_2
      client code is MVY398

      posted in General Discussion
      A
      ashigro
    • RE: Not able to connect to the websocket, please help!

      @trader_noob same here
      e6f49868-e516-4bc0-9c61-2c775230b016-image.png

      posted in General Discussion
      A
      ashigro
    • RE: Web scoket error

      this is still happening with latest python packages of smartapi
      smartapi-python==1.3.4

      posted in Python SDK
      A
      ashigro
    • RE: Historical API Max Records:500

      @skkarwasra02 It seems admin introduced this limitation to prohibit large data downloads. Earlier API allowed downloading 1min data of years too which might not be of much use. Also, it would be expensive for them as this is data-transfer-out from cloud and chargeable by cloud providers.

      posted in General Discussion
      A
      ashigro