Author |
Topic: Slippage (27 messages, Page 1 of 2) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
npn Posts: 19 Joined: Apr 14, 2008 |
Hi,
I've sent 20 live orders through the API for the last couple of days, and I've gotten some unusual slippage. The average slippage is about 2 ticks, but I've had a few cases with 3 and 4 ticks. I’ve logged extensively the activity and my results show that from the time I’ve received your quote to the time the order is out, it takes about 10 microseconds. The actual fills occur in about 50 milliseconds. I’ve also sent 3 Limit Orders at market price, and none executed. To me, it’s obvious that by the time my orders are processed, the price have moved. The only way to explain this is that your API quotes are stale, as again, the turnaround time on my side is extremely low. Please advise! |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
looking at your latest order, I do not see any problems:
on our side it is created, sent and completed at the same time (within 15ms error): 05/05/08 07:30:07.057 200007981 Create Buy 1 6EM8 MKT Executed NNikolov 208.78.170.59 05/05/08 07:30:07.057 189832 Sent 05/05/08 07:30:07.057 189833 Working #65094 05/05/08 07:30:07.057 189834 Completed A fill price is usually coming a bit later: 05/05/08 07:30:07.070 189835 Fill 1@154.24 (comm 49.5) 3586289 Regarding Limit orders - they need to be placed with opposing side (bid/ask) price to be executed immediately. Placing them with last price just adds them to the end of the order queue for the given price. Also note that it is a simulation engine, so it does not emulate exchange by 100%. Please send me exact IDs of orders you had problems with, and I would research more. |
||||
npn Posts: 19 Joined: Apr 14, 2008 |
These are all live orders.
The order you referring to had a slippage of 2 pips. Also the one before that with ID 1799559. If there’s nothing wrong with the orders, how come there’s a slippage on almost all of them? These 2 are fresh example of 2 consecutive orders with a slippage of 2 pips each. Regarding Limit Orders with Market Price, I believe I had specified the price as you suggested with the opposing side price. For example current price is 154.55/56, I’d send a buy limit order with price of 154.56. Is this what you meant? I understand the concept and I’ve seen slippage, but this is almost 100% of the time. |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
could you please explain how do you calculate slippage?
Buy market orders are completed exactly at the best offer price at the moment of processing (for quantity=1) |
||||
npn Posts: 19 Joined: Apr 14, 2008 |
My system logs the price as contract.CurrentPrice.BidPrice/contract.CurrentPrice.BidAsk right after the “oecClient.SendOrder” command.
For example: 5/6/2008 3:24:21 PM Buy 1 6EM8 MKT Sent >>>LimitBuy Order sent: Buy 1 6EM8 MKT Bid/Ask: 155.29/155.30 OnOrderConfirmed OrderID: 8188939 5/6/2008 3:24:21 PM Buy 1 6EM8 MKT Sent 5/6/2008 3:24:21 PM Buy 1 6EM8 MKT Working 5/6/2008 3:24:21 PM Buy 1 6EM8 MKT Completed 5/6/2008 3:24:21 PM Buy 1 6EM8 MKT Completed Fill:1@155.32 Fill @ 155.32 and the Ask was 155.30. Slippage: 2 More: 5/6/2008 5:41:12 PM Sell 1 6EM8 MKT >>>LimitSell Order sent: Sell 1 6EM8 MKT Bid/Ask: 155.10/155.11 OnOrderConfirmed OrderID: 8196822 5/6/2008 5:41:12 PM Sell 1 6EM8 MKT Sent 5/6/2008 5:41:12 PM Sell 1 6EM8 MKT Working 5/6/2008 5:41:12 PM Sell 1 6EM8 MKT Completed 5/6/2008 5:41:12 PM Sell 1 6EM8 MKT Completed Fill:1@155.08 Fill @ 155.08 and the Bid was 155.10. Slippage: 2 5/6/2008 6:19:01 PM Buy 1 6EM8 MKT Sent >>>LimitBuy Order sent: Buy 1 6EM8 MKT Bid/Ask: 154.94/154.95 OnOrderConfirmed OrderID: 8199030 5/6/2008 6:19:01 PM Buy 1 6EM8 MKT Sent 5/6/2008 6:19:01 PM Buy 1 6EM8 MKT Working 5/6/2008 6:19:01 PM Buy 1 6EM8 MKT Completed 5/6/2008 6:19:01 PM Buy 1 6EM8 MKT Completed Fill:1@154.95 Fill @ 154.95 and the Ask was 154.95. Slippage: 0 |
||||
npn Posts: 19 Joined: Apr 14, 2008 |
Another one just now (in a very slow market):
5/6/2008 6:40:42 PM Buy 1 6EM8 MKT Sent >>>LimitBuy Order sent: Buy 1 6EM8 MKT Bid/Ask: 155.09/155.10 OnOrderConfirmed OrderID: 8199847 5/6/2008 6:40:42 PM Buy 1 6EM8 MKT Sent 5/6/2008 6:40:42 PM Buy 1 6EM8 MKT Working 5/6/2008 6:40:42 PM Buy 1 6EM8 MKT Completed 5/6/2008 6:40:42 PM Buy 1 6EM8 MKT Completed Fill:1@155.13 Fill @ 155.13 and the Ask was 155.10. Slippage: 3 |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
sorry, I did not realize you having this problem in live environment.
We will research that as soon as possible. |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
We found no problems with order speed - the overall execution time is within 50ms.
Could it be that bid/ask prices were delayed? We are throttling bid/ask data, but in slow market it does not like to be a problem. Will research further. btw, have you ever experienced this using OEC Trader DOM? |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
Also, could you please test slippage with your application in API environment?
|
||||
npn Posts: 19 Joined: Apr 14, 2008 |
No, I haven't used Trader DOM. My code is based on your Advanced API Example.
My only conclusion is that your data is delayed - could be because of your throttling. Is there a phone number I can reach you at? It would be easier to address a few questions. |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
Your internet connection looks excellent, so I am confident that is not the network latency problem.
Did you monitor CPU/Memory/Disk usage on your computer at the time when it happened? Is the application performs any CPU/graphics intensive tasks while sending orders or processing price updates? |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
I would not recommend to use Advanced API example for live applications - it is written to sacrifice performance for clarity.
|
||||
npn Posts: 19 Joined: Apr 14, 2008 |
Our application runs on a dedicated server so I don’t much expect problems there.
I’ve used the basics from the Advanced API example, but stripped the majority of the code. No graphics, no intense calculations. Very simple application for 100% automated trading. I watch the executions with a read-only user from another machine. My results in your api (demo) environment were slightly better with Market Orders, and much better with Limit Orders. Can you recommend a code sample that I can take a look at? What about the DOM? |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
My concern was because Advanced API heavily uses data binding and datagrids, which tends to be too slow for real-time applications.
Since OEC API events are bound to creating thread, while user application is performing some task and does not process windows messages, no updates are coming to the OEC API. I mentioned Trader DOM because it displays the price ladder and allows user to send an order with just a mouse click, so you can see and compare order price, best bid/ask and position taken. Our throttling limits minimum price update interval to 50ms (20 times/sec) so I do not think it could result in such a slippage in a slow market. |
||||
npn Posts: 19 Joined: Apr 14, 2008 |
I have no Windows components that are update by any of the OEC API events; I had that concern too. The creation of an order itself could “pause” the quote updates, and/or the incoming quotes can prevent the order from being sent immediately.
Is there a way to take the Quotes events e.g. OnPriceChanged to another thread? I don’t see this particularly helping, but worth a try. Is there anything else you can suggests or check? Do you expect that using the DOM class would enhance performance (there’s a bit more processing there)? |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
There's no way to get events in the another thread.
Also I don't think using DOM class will help - it's intended for visualization of the price ladder, and DOM updates are also throttled. we will monitor ask/bid price updates tomorrow to see is there any delay. |
||||
npn Posts: 19 Joined: Apr 14, 2008 |
This almost looks like re-quotes where the slippage is always against us. If there was a delay in your data feed for some reason, slippage could be in our favor too.
My app ran on your demo environment all night, and there was slippage there too, for about 7 orders out of 34, no larger than 2 pips. Let me know if we can organize some collaborative test where we can verify and address the problem. We’re looking forward to your findings. |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
I am currently recording all bid/ask updates with timestamp for contract 6EM8 on api server.
Could you please run you app and send me your logs with bid/ask prices for a couple of orders with slippage, so I could verify this against my datafeed? |
||||
npn Posts: 19 Joined: Apr 14, 2008 |
As my results showed, not much cases of slippage in the api env. compared to prod, so I don’t know how many I would get. Here are 2, and I’ll provide more as soon as I get more:
5/7/2008 1:32:06 PM Buy 1 6EM8 MKT Sent >>>LimitBuy Order sent: Buy 1 6EM8 MKT Bid/Ask: 153.71/153.72 OnOrderConfirmed OrderID: 200008315 5/7/2008 1:32:06 PM Buy 1 6EM8 MKT Sent 5/7/2008 1:32:06 PM Buy 1 6EM8 MKT Working 5/7/2008 1:32:06 PM Buy 1 6EM8 MKT Completed 5/7/2008 1:32:06 PM Buy 1 6EM8 MKT Completed Fill:1@153.73 5/7/2008 1:39:35 PM Buy 1 6EM8 MKT Sent >>>LimitBuy Order sent: Buy 1 6EM8 MKT Bid/Ask: 153.61/153.62 OnOrderConfirmed OrderID: 200008327 5/7/2008 1:39:35 PM Buy 1 6EM8 MKT Sent 5/7/2008 1:39:35 PM Buy 1 6EM8 MKT Working 5/7/2008 1:39:35 PM Buy 1 6EM8 MKT Completed 5/7/2008 1:39:35 PM Buy 1 6EM8 MKT Completed Fill:1@153.63 |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
Thank you for the logs.
I found that my bid/ask for the time the first order was sent and completed (1:32:06.474), the bid/ask were 71/72 for at least 150ms already, so that's not your application or internet connection latency. I will consult with our price provider and will let you know as soon as I get anything new on that subject. |
||||