API Support Forum
OEC API > API Support > BUY LIMIT orders with Price X are filled when LastPrice = X and not when AskPrice = X.
Author Topic: BUY LIMIT orders with Price X are filled when LastPrice = X and not when AskPrice = X.
(4 messages, Page 1 of 1)
Moderators: VPfau
AAnatoly
Posts: 22
Joined: Jul 01, 2010


Posted: Oct 12, 2010 @ 07:17 AM             Msg. 1 of 4
Hi.

BUY LIMIT order with Price X is filled when LastPrice = X and not when AskPrice = X.

Please advice.

Here is example:

BUY LIMIT order filled at price 1153.50 at 12:17:33.953

1) Here is a log of order execution:

12:17:33.953 : Order #201224835 (Buy 1 ESZ0 LMT 1153.50) filled : 1@1153.50
12:17:33.843 : State of Order #201224835 (Buy 1 ESZ0 LMT 1153.50) changed from Working to Completed
12:16:39.234 : Command #201224836 Modify for Order #201224835 (Buy 1 ESZ0 LMT 1153.50) updated
10:51:32.361 : State of Order #201224809 (Sell 1 ESZ0 LMT 1152.50) changed from Unknown to Sent
10:51:32.346 : Command #201224809 Create for Order #201224809 (Sell 1 ESZ0 LMT 1152.50) updated


We try to understand what was AskPrice at this moment.

2) Here is an output of what we got with callback: OnPriceChangedEvent

| 12:17:33 | moAPI_OnPriceChanged Contract[ESZ0] LastPrice[1153.5] LastVol[1] AskPrice[1153.75] AskVol[209] BidPrice[1153.5] BidVol[584] Formated LastPrice[1153.50]
| 12:17:33 | moAPI_OnPriceChanged Contract[ESZ0] LastPrice[1153.75] LastVol[1] AskPrice[1153.75] AskVol[209] BidPrice[1153.5] BidVol[584] Formated LastPrice[1153.75]
| 12:17:30 | moAPI_OnPriceChanged Contract[ESZ0] LastPrice[1153.75] LastVol[1] AskPrice[1153.75] AskVol[208] BidPrice[1153.5] BidVol[584] Formated LastPrice[1153.75]


We can see here that LastPrice become 1153.5 and order filled with this price.
But, we expected that BUY LIMIT order will be filled when AskPrice will be 1153.5 and not when LastPrice is 153.5

3) Connection info:

Host="api.openecry.com"
Port="9200"
Username="AAnatolyā€¯

Account: API001127

Anatoly Gutnick
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Oct 12, 2010 @ 08:35 AM             Msg. 2 of 4
Hello,

Limit order can be executed by Bid price according FIFO. Unfortunately, our simulation environment doesn't simulate FIFO and all sim orders are treated as a front orders.

Victor Vins
Software Developer
AAnatoly
Posts: 22
Joined: Jul 01, 2010


Posted: Oct 12, 2010 @ 08:42 AM             Msg. 3 of 4
So,

is it correct that:

- on simulation environment

BUY LIMIT order with Price X will be always filled when LastPrice = X.

- or production environment:

BUY LIMIT order with Price X will be always filled when AskPrice = X.

Thanks,
Anatoly

Anatoly Gutnick
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Oct 12, 2010 @ 08:55 AM             Msg. 4 of 4
In simulation:
- if buy limit price is higher than ask price at the time of order placing, it will be filled with ask price.
- otherwise, BUY LIMIT order with Price X will be always filled when LastPrice = X or becomes better than X.

In production orders are filled according exchange rules.

Victor Vins
Software Developer