boyan-soubachov / tastyworks_api

An unofficial, reverse-engineered Python API for tastyworks.
Apache License 2.0
209 stars 79 forks source link

OrderDetails should include all available data from an order #70

Open perigvennetier opened 3 years ago

perigvennetier commented 3 years ago

Is your feature request related to a problem? Please describe. When getting all the open orders through orders = await Order.get_remote_orders(session, acct), the returned list of orders is missing a lot of the useful information from each order like the underlying, the legs information, the date and time it was placed, etc. that are present in the order_data dictionary that is being pulled in get_remote_orders.

Describe the solution you'd like The returns orders list should include all the information pulled from the API or at least the ones related to the order and that could be used for order management for example, especially the 'legs' information would be very useful.

I will try to work on it if I can figure it out. If I understand this correctly, the OrderDetails dataclass has to be updated (?).

Misc Why is there a need for OrderDetails in the first place? Can't all this be stored in the Order class directly? Or was that a structure to allow for other functionality that I have not yet seen or have not yet been developed?

bandwiches commented 3 years ago

I haven't looking into the actual call results, so just a fresh answer here. I definitely see why leg's are missing, they never get instantiated within Order.from_dict. Looks like it was just accidentally left off - just a guess here.

I'm not sure why the date's are missing, those look fine to me. My best guess without digging deeper is that it may have been a limitation of the API or they changed something. The API is pretty good, but there are still areas with mismatching keys.

perigvennetier commented 3 years ago

I added some more of the details locally, it adds more data to the details of the Order object. Not sure how to do the PR now. got to learn how to do that properly... ;)