Navigation

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

    Posts made by eulalush82234

    • RE: Websocket Reconnection

      @cyriac

      @admin please reply....

      posted in Python SDK
      E
      eulalush82234
    • Websocket Reconnection

      Hello Team,

      One question regarding websocket re-connection in the event of a disconnection.

      Got this error today:

      [W 260601 11:56:13 smartWebSocketV2:319] Attempting to resubscribe/reconnect (Attempt 1)...
      [W 260601 11:56:27 smartWebSocketV2:319] Attempting to resubscribe/reconnect (Attempt 2)...
      [W 260601 11:56:30 smartWebSocketV2:319] Attempting to resubscribe/reconnect (Attempt 3)...

      After that it seemed like the websocket reconnected. But the token ticks did not come. My question is, if there is a disconnection and re-connection made, should we resubscribe to the tokens again?

      Please let me know.

      Best Regards

      posted in Python SDK
      E
      eulalush82234
    • RE: Issue with Market Quote!

      Hi @admin @Moderator_1 @Moderator_2 ,

      Can you please reconfirm the rate limits for Market Quote?

      I still don't think it is correct.

      Here is the output from my code. It ran from 11:45 to about 12:11 then returned error. As you can see, I am only making a single call to the end point every 2 to 3 seconds. Which is about 20 per minute and 1200 every hour. This is well within the limit of 10 per second, 500 a minute and 5000 per hour.

      Also, if there are 40 tokens are called for just LTP is it considered as one call or 40 calls? (According to the documentation it should be considered as just 1 call... Still this wont explain the issue).

      Regards

      Cyriac

      12 Mar - 11:44:46: Bank Nifty Index Open_Price: 47351.35
      12 Mar - 11:44:50: Tokens: ['99926009', '41845', '41856', '41858', '41867', '41875', '41880', '41889', '41892', '41894', '41899', '41908', '41912', '41914', '41916', '41918', '41921', '41927', '41937', '41939', '41946', '41950', '41855', '41857', '41866', '41873', '41879', '41882', '41890', '41893', '41897', '41901', '41911', '41913', '41915', '41917', '41920', '41925', '41935', '41938', '41944', '41949', '41951']
      12 Mar - 11:45:55: Table created successfully.
      12 Mar - 12:11:55: An error occurred: HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Max retries exceeded with url: /rest/secure/angelbroking/market/v1/quote/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000000129154F0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))
      12 Mar - 12:13:54: Failed to fetch data: Access denied because of exceeding access rate
      12 Mar - 12:13:56: Failed to fetch data: Access denied because of exceeding access rate
      12 Mar - 12:13:59: Failed to fetch data: Access denied because of exceeding access rate
      12 Mar - 12:14:08: Failed to fetch data: Access denied because of exceeding access rate
      12 Mar - 12:14:11: Failed to fetch data: Access denied because of exceeding access rate
      12 Mar - 12:14:17: Failed to fetch data: Access denied because of exceeding access rate
      12 Mar - 12:14:19: Failed to fetch data: Access denied because of exceeding access rate
      12 Mar - 12:14:22: Failed to fetch data: Access denied because of exceeding access rate

      posted in Python SDK
      E
      eulalush82234
    • Issue with Market Quote!

      Hi @admin @Moderator_1 @Moderator_2 ,

      Facing the below issue with Market Quote End Point after just about 10 to 15 minutes. As you can see it is within the limit of 1 per second.

      My Question: Is there is there some extra limit like maximum 500 calls per day?

      11 Mar - 11:06:31: Failed to fetch data: Access denied because of exceeding access rate
      11 Mar - 11:06:33: Failed to fetch data: Access denied because of exceeding access rate
      11 Mar - 11:06:36: Failed to fetch data: Access denied because of exceeding access rate
      11 Mar - 11:06:39: Failed to fetch data: Access denied because of exceeding access rate
      11 Mar - 11:06:41: Failed to fetch data: Access denied because of exceeding access rate
      11 Mar - 11:06:44: Failed to fetch data: Access denied because of exceeding access rate
      11 Mar - 11:06:47: Failed to fetch data: Access denied because of exceeding access rate
      11 Mar - 11:06:50: Failed to fetch data: Access denied because of exceeding access rate
      11 Mar - 11:06:52: Failed to fetch data: Access denied because of exceeding access rate

      posted in Python SDK
      E
      eulalush82234
    • RE: WebSocket V2

      Sorry - I mean to say that LTP data is coming, but gets cut in a few seconds....

      posted in Python SDK
      E
      eulalush82234
    • WebSocket V2

      Hi @admin @Moderator_1 @Moderator_2 ,

      I am facing this issue while trying to subscribe to just 5 tokens for just LTP. But note that the LTP data is not coming.

      I am not sure if the issue is related to some previous connection that may be open since I have been playing around with the websocket-V2 code since morning.

      If so how exactly to close/remove the previous websocket connections?

      Or is it some other issue?

      Thanks in advance

      Cyriac

      PyDev console: starting.
      Python 3.8.9 (tags/v3.8.9:a743f81, Apr 6 2021, 14:02:34) [MSC v.1928 64 bit (AMD64)] on win32

      on open
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39320', 'sequence_number': 42423890, 'exchange_timestamp': 1709542347000, 'last_traded_price': 44485, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39321', 'sequence_number': 42423740, 'exchange_timestamp': 1709542347000, 'last_traded_price': 20735, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39326', 'sequence_number': 42424284, 'exchange_timestamp': 1709542347000, 'last_traded_price': 24520, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39325', 'sequence_number': 42423847, 'exchange_timestamp': 1709542347000, 'last_traded_price': 38295, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39328', 'sequence_number': 42423889, 'exchange_timestamp': 1709542347000, 'last_traded_price': 32565, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39338', 'sequence_number': 42423739, 'exchange_timestamp': 1709542347000, 'last_traded_price': 28815, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39325', 'sequence_number': 42425407, 'exchange_timestamp': 1709542347000, 'last_traded_price': 38080, 'subscription_mode_val': 'LTP'}
      [W 240304 14:22:26 smartWebSocketV2:319] Attempting to resubscribe/reconnect (Attempt 1)...
      on open
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39320', 'sequence_number': 42451808, 'exchange_timestamp': 1709542359000, 'last_traded_price': 43785, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39321', 'sequence_number': 42452193, 'exchange_timestamp': 1709542359000, 'last_traded_price': 21060, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39326', 'sequence_number': 42450167, 'exchange_timestamp': 1709542358000, 'last_traded_price': 24865, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39325', 'sequence_number': 42451888, 'exchange_timestamp': 1709542359000, 'last_traded_price': 37645, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39328', 'sequence_number': 42451807, 'exchange_timestamp': 1709542359000, 'last_traded_price': 32045, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39338', 'sequence_number': 42452187, 'exchange_timestamp': 1709542359000, 'last_traded_price': 29185, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39326', 'sequence_number': 42452287, 'exchange_timestamp': 1709542359000, 'last_traded_price': 24860, 'subscription_mode_val': 'LTP'}
      Ticks: {'subscription_mode': 1, 'exchange_type': 2, 'token': '39326', 'sequence_number': 42452693, 'exchange_timestamp': 1709542359000, 'last_traded_price': 24865, 'subscription_mode_val': 'LTP'}
      [W 240304 14:22:38 smartWebSocketV2:343] Connection closed due to max retry attempts reached.
      [W 240304 14:22:38 smartWebSocketV2:343] Connection closed due to max retry attempts reached.
      [W 240304 14:22:38 smartWebSocketV2:343] Connection closed due to max retry attempts reached.
      Connection closed
      Connection closed
      Connection closed

      posted in Python SDK
      E
      eulalush82234
    • RE: Calculate Margin Requirements with SmartAPI's New Margin Calculator API

      Hi @admin and @Moderator_1 , @Moderator_2

      Just a quick question here. I am looking to be able to calculate the margin for Options via API. The above end point should work fine, but I am wondering how to implement it for Option sell position when an buy position is already open.

      As you are aware, there is a difference in margin calculations for naked sell and covered sell. So please can you give some information regarding this.

      Many Thanks

      Cyriac

      posted in General Discussion
      E
      eulalush82234
    • RE: Need More Admin Responses

      @Moderator_2 @Moderator_1

      Great to see this!

      posted in General Discussion
      E
      eulalush82234
    • Need More Admin Responses

      Dear Traders,

      If you feel that the Admins should respond more to our outstanding queries, please upvote and comment on this post.

      Really, Angel has the potential to become the best broker in India for Algo traders, but there is no follow up and adequate quality control for the API.

      Hoping that Angel will devote more resources to the API Team.

      Regards
      Cyriac

      posted in General Discussion
      E
      eulalush82234
    • RE: Couldn't parse the JSON response received from the server: b'Access denied because of exceeding access rate

      @Vignesha Adding a small delay usually reduces the number of errors usually.

      @admin The reason there are so many errors is that often many traders are using get_position constantly. This is because the web socket 2.0 is often failing. Sometimes, if the get_holdings returns stale LTP, often I have to write a custom function that will get_holdings and loop for all stocks to get LTP. So if I have 5 stocks in my holdings, instead of one call to the API, I have to make 6 calls. The Angel API is being overworked. Please try to fix these....

      posted in Python SDK
      E
      eulalush82234
    • RE: What is the access_token expiry time?

      @xzion

      This is the greatest unresolved mystery in the universe currently....

      ;-(

      posted in General Discussion
      E
      eulalush82234
    • RE: Couldn't parse the JSON response received from the server: b'Access denied because of exceeding access rate

      @psm007 @admin

      I face this issue frequently while using get_position endpoint. Although it is well within the limits specified in the documentation....

      https://smartapi.angelbroking.com/docs/RateLimit

      @psm007 The limits are per second in theory, but not too sure about practice unfortunately....

      posted in Python SDK
      E
      eulalush82234
    • A New Error!

      Hi @admin

      Getting this new error today. Not too sure what the issue is? Code is same as yesterday which worked fine. No changes made.

      ConnectionError: HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Max retries exceeded with url: /rest/auth/angelbroking/user/v1/loginByPassword (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000286A29BC850>: Failed to establish a new connection: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted'))

      Please do share your thoughts if possible
      Thanks
      Cyriac

      posted in Python SDK
      E
      eulalush82234
    • RE: Difference between status and orderstatus

      @admin Very Useful. Thanks !

      posted in Python SDK
      E
      eulalush82234
    • RE: Robo order issue

      @admin All my posts are unable to be posted saying queued for approval

      Request you to do the needful.

      Thanks

      posted in General Discussion
      E
      eulalush82234
    • RE: Robo order issue

      @ARTraders007 @admin

      Could you please clarify the exact status of Robo orders?

      Under which conditions it will work and which conditions it will not work?

      Whether we can cancel the SL and Target orders via API or not?

      Clarity is essential!

      posted in General Discussion
      E
      eulalush82234
    • API Error - Several Times Today

      Hi Admin @admin

      Getting this error several times when I run my Algo.
      Any thoughts? Thanks in Advance.
      Cyriac

      Traceback (most recent call last):
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 174, in _new_conn
      conn = connection.create_connection(
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\connection.py", line 95, in create_connection
      raise err
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
      sock.connect(sa)
      socket.timeout: timed out

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
      httplib_response = self._make_request(
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
      self._validate_conn(conn)
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
      conn.connect()
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 358, in connect
      self.sock = conn = self._new_conn()
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 179, in _new_conn
      raise ConnectTimeoutError(
      urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x00000000077CCBE0>, 'Connection to apiconnect.angelbroking.com timed out. (connect timeout=7)')

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 489, in send
      resp = conn.urlopen(
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
      retries = retries.increment(
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\retry.py", line 592, in increment
      raise MaxRetryError(_pool, url, error or ResponseError(cause))
      urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Max retries exceeded with url: /rest/secure/angelbroking/order/v1/getPosition?%7B%7D (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000000077CCBE0>, 'Connection to apiconnect.angelbroking.com timed out. (connect timeout=7)'))

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "E:\Python\2. X Basic Trade Algo.py", line 212, in <module>
      get_position()
      File "E:\Python\2. X Basic Trade Algo.py", line 94, in get_position
      positions = obj.position()["data"]
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\smartapi\smartConnect.py", line 331, in position
      positionResponse= self._getRequest("api.position")
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\smartapi\smartConnect.py", line 223, in _getRequest
      return self._request(route, "GET", params)
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\smartapi\smartConnect.py", line 180, in _request
      raise e
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\smartapi\smartConnect.py", line 169, in _request
      r = requests.request(method,
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\api.py", line 59, in request
      return session.request(method=method, url=url, **kwargs)
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 587, in request
      resp = self.send(prep, **send_kwargs)
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 701, in send
      r = adapter.send(request, **kwargs)
      File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 553, in send
      raise ConnectTimeout(e, request=request)
      requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Max retries exceeded with url: /rest/secure/angelbroking/order/v1/getPosition?%7B%7D (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000000077CCBE0>, 'Connection to apiconnect.angelbroking.com timed out. (connect timeout=7)'))

      posted in General Discussion
      E
      eulalush82234
    • RE: MTM Position

      @admin Any chance there is some sample code for this?

      Thanks

      posted in General Discussion
      E
      eulalush82234
    • RE: MTM Position

      @admin Please Help.

      Thank You

      posted in General Discussion
      E
      eulalush82234
    • MTM Position

      Hello Admin,
      Can you advise on how to get the MTM (Live PnL) of an Intraday position?

      I am using the Python SDK and have seen the "Get Position" command. Though this does not return the MTM specifically.

      Thank you in advance.

      Cyriac

      posted in General Discussion
      E
      eulalush82234