开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: Time of order submission


 

You are correct. A better name for the Order quantity field would probably be "current quantity" or "remaining quantity". IBKR automatically decrements the field value after each partial fill. Or in case of child orders in a Bracket Order, IBKR will automatically sets quantities for all child orders to the actual fill quantity of the parent . And your client application can adjust the value at any point in time, too (up or down).

If you need the original order quantity for orders at time of placement, you need to persist that information within the scope of your client application. Or if you want to avoid having to save state, you can use the OrderRef field as I had pointed out before. It is perfectly fine if you define a few context fields, encode them, for example, as a Json string, and store that string in the OrderRef field of the order. The OrderRef field description is best summarized in the Execution class as:

  • The OrderRef is a user-customizable string that can be set from the API or TWS and will be associated with an order for its lifetime

For the special case where your client applications do not change the order quantity after order placement, you can reconstruct the original order quantity from the orderStatus() callback. Each time you receive an orderStatus() update, it provides the actual "filled" and "remaining" quantities at that point in time.

闯ü谤驳别苍

?

?

On Fri, Sep 27, 2024 at 06:40 PM, Jesse Stone wrote:

Thanks very much for this information. That makes sense. I just wanted to be sure I was not missing something.

It appears that the total number of shares of the order is missing also? There is "TotalQuantity", but that appears to be the shares remaining to be filled, rather than the total requested, and it drops to zero if the order is cancelled, such that one cannot recover the original number of shares requested from the information provided. I guess I need to keep track of all such quantities myself, but please let me know if my understanding of "TotalQuantity" is not correct. Thanks again very much for your help.

Join [email protected] to automatically receive all group messages.