Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Individual order status API throws error for unknown reason!

    Python SDK
    0
    5
    45
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      projectSB last edited by

      @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)

      M 1 Reply Last reply Reply Quote 0
      • M
        Moderator_2 @projectSB last edited by

        Hi @projectSB

        Kindly share us the client code to analyze on the issue.
        Please confirm which API consumed to retrieve the status of the order. (either orderbook or tradebook)

        https://apiconnect.angelbroking.com/rest/secure/angelbroking/order/v1/getOrderBook
        https://apiconnect.angelbroking.com/rest/secure/angelbroking/order/v1/getTradeBook

        Thanks & Regards,
        SmartAPI team

        P 1 Reply Last reply Reply Quote 0
        • P
          projectSB @Moderator_2 last edited by projectSB

          @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.

          B 1 Reply Last reply Reply Quote 0
          • B
            bm0126782 @projectSB last edited by

            @projectSB But how to get the "uniqueOrderID" as once you placed order, you usually get the order id not uniqueOrderID. can you please share some light.
            @Moderator_2 , @projectSB

            M 1 Reply Last reply Reply Quote 0
            • M
              Moderator_2 @bm0126782 last edited by

              Hi @pskale7755

              You can fetch unique order ID from place order response under key uniqueorderid
              Reference:
              https://smartapi.angelbroking.com/docs/Orders

              Sample Response:
              {
              "status":true,
              "message":"SUCCESS",
              "errorcode":"",
              "data":{
              "script":"SBIN-EQ",
              "orderid":"200910000000111"
              "uniqueorderid":"34reqfachdfih"
              }
              }

              1 Reply Last reply Reply Quote 0
              • First post
                Last post