Skip to content

Update wrapper.py #150

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gdassori
Copy link

@gdassori gdassori commented Jun 9, 2025

No description provided.

@gdassori
Copy link
Author

gdassori commented Jun 9, 2025

Traceback (most recent call last):
File "/home/user/venv/lib/python3.11/site-packages/ib_async/decoder.py", line 175, in interpret
handler(fields)
File "/home/user/venv/lib/python3.11/site-packages/ib_async/decoder.py", line 1352, in completedOrder
self.wrapper.completedOrder(c, o, st)
File "/home/user/venv/lib/python3.11/site-packages/ib_async/wrapper.py", line 542, in completedOrder
self._results["completedOrders"].append(trade)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'completedOrders'

@mattsta
Copy link
Contributor

mattsta commented Jun 10, 2025

Thanks for looking at that problem!

I'm not sure this is the actual cause of the error though. What was your usage to get this error?

Following the logic of the code, running reqCompletedOrdersAsync() creates the "completedOrders" key so it would exist when the data arrives from the server later to be added to the result list. The only error condition I see is if something is sending completedOrder commands without a user requesting data from reqCompletedOrdersAsync() first?

Overall the logic for setting the dynamic result containers should be cleaner overall for auto-adding/adjusting keys dynamically, but I haven't seen this trigger errors before (the request creates the dict key before results arrive (over in startReq()).

If you don't see anything obvious with your usage, I'll try more combinations of using it. Looking at my own usage, I only use ib.fills() for checking executions over time and reqCompletedOrders doesn't seem very popular?

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

Successfully merging this pull request may close these issues.

2 participants