erdewit / ib_insync

Python sync/async framework for Interactive Brokers API
BSD 2-Clause "Simplified" License
2.83k stars 765 forks source link

Trade status event not emitted #245

Closed dmoklaf closed 4 years ago

dmoklaf commented 4 years ago

ib_insync version: 0.9.59

An order that is larger than the account's available margin triggers the following (expected) error from IB: Error 201, reqId 61: Order rejected - reason:YOUR ORDER IS NOT ACCEPTED. IN ORDER TO OBTAIN THE DESIRED POSITION YOUR EQUITY WITH LOAN VALUE ...

This error is handled by ib_insync in the wrapper.py lines 1014-1022. The library emits events to notify the library caller that the order status has changed:

A trade status event shall be emitted.

PS: searching through the code, other places emitting such events are correct: on line 394 a trade status event is correctly emitted. So line 1022 seems to be the only place where a trade status event is missing

erdewit commented 4 years ago

This issue is fixed in release 0.9.60.