开云体育

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

Java API, ordering question


usernew
 

When I say qty=500, and market order type, price = 20.00,
how does IB fulfill the order if it is not able to find all 500
shares at 20.00 ? How will I know the prices at which different
portions were bought ? What else should I be careful of while using
MKT order type.

Thanks.


marinindextrader
 

Market Order Price Values are ignored or not required...

A proper MKT order call looks like this in a literal sense:

Call PlaceNewOrder("BUY", 1, "ES", "FUT", "200209",
0, "", "GLOBEX", "", "MKT", 0, 0)

This is a MKT order call for one contract of September ES on the
Globex Exchange. Of course one can use variables of proper type in
lieu of literals...

In order to asses the results of your Market Order you will need to
use: Call reqExecutions

The data will then be fed back through the openOrder1(), openOrder2
(), and orderStatus() Events where they can be captured, analyzed and
diseminated...

Begin by reading the TWS API help files. Though brief in nature, they
are concise and indespensible in understanding how all of the events
and methods tie together...

Events Syntax:


X_Other/activexevents.htm

Methods Syntax:


X_Other/activexmethods.htm

Properties Syntax:


X_Other/activexproperties.htm


Scott

--- In twsapi@y..., usernew <no_reply@y...> wrote:
When I say qty=500, and market order type, price = 20.00,
how does IB fulfill the order if it is not able to find all 500
shares at 20.00 ? How will I know the prices at which different
portions were bought ? What else should I be careful of while using
MKT order type.

Thanks.


usernew
 

I have read the APIs but I am still not sure how things work hence
these questions.

When I submit an order of type MKT, it will sell stocks at whatever
the market bid price happens to be when I submit the order ? and it
will buy stocks at whatever the market ask price happens to be ?

Also, I am still curious about what happens if it is not able to find
all the stocks I am requesting at one price. I assume it will do
partial fills with different prices. I can tell this because there is
the average price coming in to orderStatus() event. Is it possible to
tell how many of the stocks were purchased at what price without
doing any guessing ?

Thanks.

--- In twsapi@y..., "marinindextrader" <marinindextrader@y...> wrote:
Market Order Price Values are ignored or not required...

A proper MKT order call looks like this in a literal sense:

Call PlaceNewOrder("BUY", 1, "ES", "FUT", "200209",
0, "", "GLOBEX", "", "MKT", 0, 0)

This is a MKT order call for one contract of September ES on the
Globex Exchange. Of course one can use variables of proper type in
lieu of literals...

In order to asses the results of your Market Order you will need to
use: Call reqExecutions

The data will then be fed back through the openOrder1(), openOrder2
(), and orderStatus() Events where they can be captured, analyzed
and
diseminated...

Begin by reading the TWS API help files. Though brief in nature,
they
are concise and indespensible in understanding how all of the
events
and methods tie together...

Events Syntax:


X_Other/activexevents.htm

Methods Syntax:


X_Other/activexmethods.htm

Properties Syntax:


X_Other/activexproperties.htm


Scott


--- In twsapi@y..., usernew <no_reply@y...> wrote:
When I say qty=500, and market order type, price = 20.00,
how does IB fulfill the order if it is not able to find all 500
shares at 20.00 ? How will I know the prices at which different
portions were bought ? What else should I be careful of while
using
MKT order type.

Thanks.