Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. projectSB
    3. Posts
    P
    • Profile
    • Following 0
    • Followers 0
    • Topics 13
    • Posts 37
    • Best 4
    • Groups 0

    Posts made by projectSB

    • getMargin function is not considering active positions for margin calculations

      Hi @admin ,

      smartApi.getMarginApi(position_params) - This API is supposed to calculate the margin requirement for the basket of orders included in the 'position_params'.

      However, this is not considering the already open positions for margin calculations. So, it becomes very difficult to calculate the exact cash requirement for us traders in real time, for legged option positions.

      Is this expected? Or how do I force the API to consider active positions?

      Please help!
      Thanks!
      -Sid

      posted in Python SDK
      P
      projectSB
    • RE: Web Socket Issue

      @Nichil72 I have messaged you, and shared my email.

      posted in Java SDK
      P
      projectSB
    • RE: Web Socket Issue

      @Nichil72 Message me directly. I can help with Python development.

      posted in Java SDK
      P
      projectSB
    • RE: Release Note: Free Historical Data Access for Indices, NSE, NFO, BSE, BFO, MCX, and CDS with SmartAPI!

      @Moderator_1 Yes please! OI data will help us a lot

      posted in General Discussion
      P
      projectSB
    • RE: Websocket Connection automatically closes after placing a order

      @rohit4417k Are you placing orders from the same thread as Websocket?
      If yes, then it will disconnect as order placement makes the Websocket out of sync. Always, use a separate thread for monitoring data and placing orders etc. Your Websocket thread should ONLY fetch the data and store in some data structure.

      I had faced this issue, and this was my way of resolving it. Others might have different opinion as well.

      posted in Python SDK
      P
      projectSB
    • How many simultaneous instances are allowed for a single client of SmartAPI?

      @admin @Moderator_1 @Moderator_2 @Moderator_3

      How many simultaneous instances of SmartAPI applications are allowed for a single client of AngelOne?

      posted in General Discussion
      P
      projectSB
    • RE: I think they are changing or updating the script master

      @Mnagesh I hate when A1 folks change things without notification! They don't understand the kind of disruption and anxiety it creates.

      @admin @Moderator_1 @Moderator_2 - What is the update regarding this issue?

      posted in General Discussion
      P
      projectSB
    • SmartAPI website shows weird URL - cloudFront

      Hi @admin @Moderator_1 @Moderator_2

      Is there a change in the URL of the SmartAPI pages? When I try to login to SmartAPI to enable TOTP, I see this as the URL:

      https://d24vxxstyf61rc.cloudfront.net/enable-totp

      Is this valid? Or this might be a phishing attack?? Please confirm ASAP!

      Here is the screenshot for the same:

      SmartAPI_cloudFront.JPG

      posted in General Discussion
      P
      projectSB
    • RE: AngelOne RMS is unable to quickly adjust margins for spreads!

      @Moderator_1 Hello, what is the update on this issue?

      Also, please mention if there is any difference in INTRADAY margin vs CARRYFORWARD margin. If yes, then by how much?
      Or you can use current week's Nifty ATM options to get the answer.

      You can use the example mentioned in the screenshot itself. I don't think that we get any leverage in FNO trading from AngelOne. Please confirm. In that case we will use only CARRYFORWARD orders.

      posted in General Discussion
      P
      projectSB
    • RE: AngelOne RMS is unable to quickly adjust margins for spreads!

      @Moderator_1 And also note that, I always trigger BUY orders, wait for its completion and then trigger SELL orders to get the margin benefits. FYI

      posted in General Discussion
      P
      projectSB
    • RE: AngelOne RMS is unable to quickly adjust margins for spreads!

      @Moderator_1 In that case, it seems that the RMS is

      1. Holding much more amount than the margin required! For example, this is what your margin calculator shows:

      ea936a72-d992-4233-99ac-dc5c59267fda-image.png

      And this is what was left in my usable funds when I was trading the same setup:
      I have around 1.47 lakhs as funds, and during the trade I had around 80000 remaining, so approx 70000 was captured as margin (55% more than what's shown!)!

      BNF_1lot4legs_margin.JPG

      Check my order and trade history for today, and you will be able to verify. Client code: S382492

      1. And secondly, in real time, this margin captured is even more! Meaning if I have to place 4 orders simultaneously the RMS is slow in getting the actual hedged margin.
      posted in General Discussion
      P
      projectSB
    • This is how a profitable position ends up losing due to unreliable SmartAPIs: Max retries exceeded with url: /rest/secure/angelbroking/order/v1/placeOrder (Caused by ConnectTimeoutError

      @admin @Moderator_1 @Moderator_2

      Could someone please explain why I got this error while placing orders today?

      Sequence of events:
      1 order was placed and it was Completed
      LOG entry: 2024-02-16 15:04:40,330 BUY avgPrice of BANKNIFTY29FEB2446600CE: 623.45 order_ID: 240216001663375 complete

      The second order got the following error:

      LOG entry: 2024-02-16 15:04:47,346 HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Max retries exceeded with url: /rest/secure/angelbroking/order/v1/placeOrder (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0F5F12C8>, 'Connection to apiconnect.angelbroking.com timed out. (connect timeout=7)'))

      Client code: S382492

      Note:

      1. The failed order did not reach the portal at all. Had to exit remaining ones manually, with loss!

      2. I have been using the same code block for last few days, and it was working fine, so its NOT a code issue.

      3. It was only the 2nd order, thus rate limit could NOT have exceeded.

      Please provide a proper explanation, and how to rectify it. Else I will have to switch back to Zerodha. Also, try answering my previous queries, which are still open without replies.

      posted in Python SDK
      P
      projectSB
    • RE: Session termination issue

      @Moderator_2 Hey, I have just posted the same issue today!

      Order_Status_issue_cropped.JPG

      Seems like this issue is NOT fixed! Please clarify what do you mean by "consume the recent SDK". Specific steps will really help!

      posted in Python SDK
      P
      projectSB
    • RE: Individual order status API throws error for unknown reason!

      @Moderator_2 I have used neither of the APIs you have mentioned. There is another API:

      orderResponse = smartApi.individual_order_details(uniqueOrderID)

      This allows you to extract the order status (Open, Completed or Rejected, and other details) directly without the need to fetch the whole orderbook / tradebook.
      Isn't this the whole purpose of bringing the 'UniqueOrderId' feature you guys deployed?

      Reference: https://smartapi.angelbroking.com/topic/4013/important-update-individual-order-status-api-using-unique-order-id-10-requests-second

      Anyways, my client ID is S382492

      Please have a look and suggest what's the root cause. And also, whether we should be using the new API or not.

      posted in Python SDK
      P
      projectSB
    • Individual order status API throws error for unknown reason!

      @admin @Moderator_1 @Moderator_2

      Hi Folks,

      Please check the below issue:
      I have used the individual order status API to fetch the order status after firing an order. It was working fine, but it threw the following error for one of them:

      Order_Status_issue_cropped.JPG

      The error was: [E 240208 15:03:27 smartConnect:479] Error occurred in ind_order_details: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

      Note that the actual order got executed - order ID - 240208002143933.

      Kindly help in understanding the root cause to avoid such issues in the future.

      Here is the the code block used by me:

      response = smartApi.placeOrderFullResponse(orderparams)
      print(response)
      if response['message'] == "SUCCESS":
      uniqueOrderID = response['data']['uniqueorderid']
      while True:
      orderResponse = smartApi.individual_order_details(uniqueOrderID)
      if orderResponse['data']['orderstatus'] == 'complete':
      orderStatus = orderResponse['data']['orderstatus']
      orderID = orderResponse['data']['orderid']
      avgPrice = orderResponse['data']['averageprice']
      logger.info(transactionType+" avgPrice of "+tradingSymbol+": "+str(avgPrice)+" order_ID: "+str(orderID)+" "+orderStatus)
      break
      if orderResponse['data']['orderstatus'] == 'rejected':
      break
      time.sleep(0.1)

      posted in Python SDK
      P
      projectSB
    • RE: Basket order support

      @shashwatVar @admin @Moderator_1 @Moderator_2

      A much needed feature! Please confirm when this will be available in SmartAPI.

      posted in General Discussion
      P
      projectSB
    • AngelOne RMS is unable to quickly adjust margins for spreads!

      @admin @Moderator_1 @Moderator_2

      Hi folks,

      Please explain in which way the RMS system in AngelOne works?

      Consider a simple Calendar spread - a near PUT sell, a far PUT buy.
      Approx margin required is Rs.30000 for the whole spread.

      Situation 1:
      When I want to sell the near PUT, if I have already bought the far PUT, do I get the margin benefit?
      That is will the order execute if I have 30000 in funds, instead of the naked PUT sell margin of RS 1,20,000 approx.

      or Situation 2:
      When I want to sell the near PUT, I MUST have the full margin available (Rs. 1,20, 000 approx), regardless of the the previous far PUT (hedge) being bought or not?

      Please confirm!

      Note: In Zerodha, this margin benefit is automatic. That is, it happens like in situation 1. If I have bought my hedge beforehand, I get full margin benefit during my sell leg.

      posted in General Discussion
      P
      projectSB
    • RE: Important Update: Individual Order Status API using Unique Order ID (10 Requests/Second)

      @projectSB I figured it out!
      Used the following method. Hope this help others too:

      def individual_order_details(self, qParam):
      url = self._rootUrl + self._routes["api.individual.order.details"] + qParam
      try:
      response_data = self.make_authenticated_get_request(url, self.access_token)
      return response_data
      except Exception as e:
      logger.error(f"Error occurred in ind_order_details: {e}")
      return None

      posted in General Discussion
      P
      projectSB
    • RE: Important Update: Individual Order Status API using Unique Order ID (10 Requests/Second)

      @Moderator_1 Much awaited feature! Thanks!
      Just need some more clarification:

      Say I placed an order using "placeOrderFullResponse(orderparams)".

      Now I can extract the uniqueOrderID from the response here. Now what do I do next to get the orderStatus from exchange?

      Which Python function should I use to see whether my order was Completed or not?

      A simple code block to illustrate this would be really appreciated!

      UPDATE: I tried using normal requests (GET) to fetch the order status, but the response says 'Invalid token'.

      {"success":false,"message":"Invalid Token","errorCode":"AG8001","data":""}

      However, I can see that the order in the 'https://www.angelone.in/trade/orders/history'. Please help!

      posted in General Discussion
      P
      projectSB
    • RE: List of all Smartapi functions in Python

      @Mnagesh Thanks!
      However, there is an API for getting individual order status. I don't see that mentioned here? Could you please provide that as well?
      OR
      Let's say I have placed an order. How to get the exact status of that individual order? What are my options in this case?
      I want to know whether my order is still pending or complete before placing orders of other legs.

      posted in Python SDK
      P
      projectSB