Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OrderStatus to GetOrdersRequest #544

Open
1 task done
Brett55 opened this issue Dec 28, 2024 · 4 comments
Open
1 task done

Add OrderStatus to GetOrdersRequest #544

Brett55 opened this issue Dec 28, 2024 · 4 comments

Comments

@Brett55
Copy link

Brett55 commented Dec 28, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

I can't search on OrderStatus so I end up hitting the limit of 500 results. Either lift the limit of 500 for GetOrdersRequest or add OrderStatus as a new filter.

Describe the solution you'd like.

Either lift the limit of 500 for GetOrdersRequest or add OrderStatus as a new filter.

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

@hiohiohio
Copy link
Contributor

@Brett55 How about using after/until to get all orders? Default sorting direction is desc. Therefore, you can get the submitted_at of the last record of the response, and use the time as until parameter to fetch orders more than 500.

@Brett55
Copy link
Author

Brett55 commented Dec 30, 2024

@hiohiohio Yea that is what I'm doing as a hack, but I think being able to filter on OrderStatus seems logical. Also using after/until is fine but I have to be careful not to include duplicate records in my results. For instance, this is how I get my until argument, but there is a chance I end miss records.

oldest_order_date = orders[-1].created_at - timedelta(microseconds=1)

@hiohiohio
Copy link
Contributor

@Brett55 Oh, please try to use submitted_at instead of created_at. Also, until is exclusive and considering samesubmitted_at orders, add 1 microseconds would be safer I think. But you might get duplicated orders in response. Therefore, de-duplication based on order_id is required in addition.

oldest_order_date = orders[-1].submitted_at + timedelta(microseconds=1)

for the order status filtering, open/closed filter is not working for you? Even though filtering by status, if placed orders are more than 500, we should implement those handling. Feels it should be handled in alpaca-py layer though...

@Brett55
Copy link
Author

Brett55 commented Dec 30, 2024

Yea I think this endpoint really needs pagination setup to make it easier. Don't think SDK users should need to do de-duping on their end and this offset time thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@hiohiohio @Brett55 and others