Navigation

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

    Get Order details

    Python SDK
    3
    6
    233
    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.
    • K
      kiran1808 last edited by

      Hi, can anyone post the code to get order details in python?
      Thanks in advance

      S James Bond 4 Replies Last reply Reply Quote 0
      • S
        Surya 1 @kiran1808 last edited by

        @kiran1808

        when you send orders it will give you an order id. You can fetch order book and match the order id. Have a look here

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

        1 Reply Last reply Reply Quote 0
        • James Bond
          James Bond @kiran1808 last edited by

          @kiran1808
          You mean complete order book or talking about details of particular order ?

          “Bond. James Bond.”

          1 Reply Last reply Reply Quote 0
          • James Bond
            James Bond @kiran1808 last edited by

            @kiran1808
            Following fragment of code fetches details about particular order.

            OrderBook = Obj.orderBook()['data']
            for i in OrderBook:
                if i['orderid'] == 'your_order_id':
                    print(i['averageprice'], i['updatetime'])
            

            If you want to fetch complete order book, just remove if condition.

            “Bond. James Bond.”

            K 1 Reply Last reply Reply Quote 0
            • James Bond
              James Bond @kiran1808 last edited by

              @kiran1808
              Also, following methods will help you

              Obj.position 
              Obj.tradebook 
              

              fetches order details. Depending on your use, you can choose any of them.

              “Bond. James Bond.”

              1 Reply Last reply Reply Quote 0
              • K
                kiran1808 @James Bond last edited by

                @James-Bond Thanks a lot for sharing, have a great day 🙂

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