studerw / td-ameritrade-client

TD Ameritrade Java Client
Apache License 2.0
69 stars 47 forks source link

PlaceOrder question #42

Closed medaramesh closed 3 years ago

medaramesh commented 3 years ago

Hi Its actually question. I have used placeOrder and it went through successfully. But how do I know the order is placed. Does this api return order id or status ? or Do I need to run fetchorders to verify ? or I can set my own orderid to placeorder so that I can fetch by orderid to verify the existence ?

studerw commented 3 years ago

From what I’ve seen, after you place an order, you need to sleep for a second or so, and then run fetch orders. Because the place order call returns immediately, but the order is placed on a queue on TDA’s side, it can’t return the completed order right away. So you have to wait and then fetch it again, possibly polling until you know it’s completed.

On Thu, Feb 25, 2021, at 15:21, medaramesh wrote:

Hi Its actually question. I have used placeOrder and it went through successfully. But how do I know the order is placed. Does this api return order id or status ? or Do I need to run fetchorders to verify ? or I can set my own orderid to placeorder so that I can fetch by orderid to verify the existence ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/studerw/td-ameritrade-client/issues/42, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQHJA3IHT43TTRGVJJUNZDTA2WNBANCNFSM4YHFLCGA.

medaramesh commented 3 years ago

Thanks a lot. It seems response to placeOrder has header information called Location in the below format. https://api.tdameritrade.com/v1/accounts/AccountId/orders/OrderID. But PlaceOrder is not returning response. It would be helpful if provide a method to get orderid. Any how Big Thanks for this library. Its really useful. Thanks is a small word