[Question]: list_orders() Quantity
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Current Behavior
This is not a bug, it is a question. I can’t find any documentation or example about this.
I know how to show a list of orders:
api = alpaca.REST(api_key, api_secret, base_url, api_version='v2')
ORDERS = api.list_orders()
But what I don’t know, is how to get the quantity of orders I have open right now. I don’t have the order id, I just have the symbol
For example: I want to know the exact qty of open orders I have to sell TSLA to avoid submitting another order.
Thanks in advance for your response.
Expected Behavior
Get orders qty
SDK Version I encountered this issue in
Alpaca-trade-api- == 2.0.0
Steps To Reproduce
Try to get the quantity of open orders for a given symbol (Ex: TSLA)
Filled out the Steps to Reproduce section?
- I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.
Anything else?
No response
Issue Analytics
- State:
- Created a year ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
ListOrders - Services.amazon.com
The ListOrders operation includes order information for each order returned, including AmazonOrderId, OrderStatus, FulfillmentChannel, and ...
Read more >Amazon OA SDE-1 New Grad (2021 Batch) (India) - LeetCode ...
Working solution to the problem with full explanation : Logic : I've passed my comparator function and then applied the logic inside the...
Read more >Iterate through all list orders - python - Stack Overflow
I first considered using a list to store the numbers 1 to 11 then just randomising the list order using the shuffle function....
Read more >Aggregate Query Question - Salesforce Developer Community
I have a process that will read through an order when it is updated and determine if there are duplicate sku's on the...
Read more >LINQ statement to list orders with outstanding items to be ...
I need a LINQ statement which generates a list of sales orders where there is an outstanding qty of items to be shipped...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah sorry, did you mean the sum of the quantity field of all open orders? Not just the number of orders?
If that’s the case then that’s not really something we need to provide direct capabilities too into the SDK imo, as it would be common/easy enough to do it with general python functionality. IE reducing over the list of returned orders or using a for loop would be the first things that come to mind.
For example does something like :
give you the result you’re looking for?
@drew887 Sorry man, my mistake
len(ORDERS)
is the man.Thanks again and sorry for the inconvenience