API Support Forum
OEC API > API Support > how to get current bid/ask without waiting for onPriceChanged Event.
Author Topic: how to get current bid/ask without waiting for onPriceChanged Event.
(27 messages, Page 1 of 2)
Moderators: VPfau
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Feb 28, 2011 @ 11:49 PM             Msg. 1 of 27
Hi,

I want to get the current market for a future without having to wait for an onPriceChanged event. This is relevant for illiquid securities for which markets are not updated that often. How can I do this ?

Apologies for cross posting, but I realized that the question is more relevant in this. Thanks in advance,

Brandon

Brandon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 01, 2011 @ 08:33 AM             Msg. 2 of 27
Hello,

The first time after subscribing OnPriceChanged will be called immediately with the latest snapshot of quote that we have received from our data provider.

Victor Vins
Software Developer
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 01, 2011 @ 11:46 AM             Msg. 3 of 27
hmm,

That would seem reasonable. However it doesnt always seem to happen that way, for both the api and the prod environment. I have found lag times of at least 20seconds for some securities.
Is there some way to manually trigger the update ?

thanks,

Brandon

Brandon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 01, 2011 @ 12:14 PM             Msg. 4 of 27
Please specify timestamp and symbols of the issues, we will research the reason of lag.

Victor Vins
Software Developer
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 01, 2011 @ 12:42 PM             Msg. 5 of 27
for example, CLTM1, I subscribed at 2:26:30 est and got the first onPriceChanged event at about 2:26:49pm est, yesterday 28th feb 2011.
On feb25th I subscribed to sb-m-sh1 at at about 13:25 est and did not get any updates ( the market closed 13:30pm). Strange thing is that I have traded that contract in the past, so even though flat, I think I automatlcally subscribe to this.

This seems to be intermittent.
Can you think of any way to force a refresh ?

Thanks

Brandon
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 01, 2011 @ 12:43 PM             Msg. 6 of 27
PS. These examples are both for the production server.

Brandon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 01, 2011 @ 01:15 PM             Msg. 7 of 27
If you have even flat position, you are subscribed automatically for these contracts. In this case, you got the snapshot immediately after connecting to OEC and Contract.CurrentPrice should contain this snapshot. Could you please check it?

Victor Vins
Software Developer
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 03, 2011 @ 12:30 AM             Msg. 8 of 27
Hi,

Thanks for the suggestion. I was able to get the data I needed from Contract.CurrentPrice. As am asoed the contracts I mentioned earlier however still seem to behaving strangely. They dont seem to update any new trades (via lastPrice, lastDatetime and lastVol), just changes in the bid/ask quotes --- even though I have executed trades, the new trade is not reported in the OnPriceChanged event.

Brandon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 03, 2011 @ 08:06 AM             Msg. 9 of 27
Hello,

could you send me order id that was not reported back via quotes?

btw, the most reliable way to get all trades is to use tick subscription, not quote subscription.

Victor Vins
Software Developer
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 03, 2011 @ 09:53 AM             Msg. 10 of 27
Will tick subscription provide the bid ask quotes ?

I traded 38528322 which was not reported back to via an onchangedPrice event. This stream did not seem to update any trades after subscription ...

Thanks,

Brandon

Brandon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 03, 2011 @ 10:38 AM             Msg. 11 of 27
If you are using the latest version of OECAPI, yes, ticks contain bid/ask info too.

The issue with TAS ticks has been localized and developers have been notified. Thank you for details!

Victor Vins
Software Developer
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 03, 2011 @ 12:30 PM             Msg. 12 of 27
I was not aware you could do that.
Just to be clear. I see three ways of subscribing to OEC data:

1) SubscribeTicks
2) Subscribe and having OnPriceChangedEvent feeding OnPriceChanged handler.
3) Subscribe and having OnPriceTick feeding OnPriceChanged handler.

Are you referring to option 1) ? What events does this trigger - OnPriceTicks ?

Currently I am using 3.5.0.0 of the API and version 3.5.022 of the OEC Trader Developer and 3.5.0.21 of the OEC Trader.

Brandon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 03, 2011 @ 02:13 PM             Msg. 13 of 27
OnTicksReceived is a event for SubscribeTicks.

API from OEC Trader 3.5.0.21 has this functionality.

Victor Vins
Software Developer
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 03, 2011 @ 03:42 PM             Msg. 14 of 27
The API that comes with my 3.5.0.21 of OEC Trader (i.e. in the OEC API COM 3.5 branch of the OEC Trader installation) has a version of 3.5.0.0 under c# properties. I just want to make sure I have the most up to date versio of the API. If not, then where do I get it ?

Thanks again,

Brandon

Brandon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 03, 2011 @ 04:02 PM             Msg. 15 of 27
All versions of OECAPI for one branch has the same version number - 3.5.0.0. This is confusing, but we have to go this way.

Victor Vins
Software Developer
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 03, 2011 @ 06:18 PM             Msg. 16 of 27
The API which is packaged with OEC Trader 3.5.0.21 (the most recent LIVE trading platform I could find) does NOT have that functionality.


The API which is packaged with OEC Trader Developer 3.5.0.22 (the most recent DEMO trading platform I could find) does have that functionality.

I want to trade LIVE. Can I use the API from the demo trading platform for live trading ?

Brandon
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 03, 2011 @ 06:39 PM             Msg. 17 of 27
Nevermind. I was looking at an outdated file. Where should we be downloading the API files from for updates ?

Brandon
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 04, 2011 @ 01:10 AM             Msg. 18 of 27
Hi,

I have been playing with the Tick subscription and I have a few questions.

1.This does not provide me with bid/ask volumes, correct ?
2.This only fires when an actual trade occurs ?

For my application I need to track the bid/asks, so it would seem that quote subcription triggered by OnPriceTick might be better. but what did you mean when you said tick subscription was more reliable in capturing trades ?

Thanks,

Brandon

Brandon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 04, 2011 @ 08:17 AM             Msg. 19 of 27
Hello,

1. Right, there are no bid/ask volumes
2. Right, it triggers only when actual trade occures.

The difference with quotes - tick event triggers for every trade, quote subscription is throttled one and some trades can be missed on client side.

Victor Vins
Software Developer
BBrandon
Posts: 24
Joined: Dec 08, 2010


Posted: Mar 04, 2011 @ 09:33 AM             Msg. 20 of 27
Hi,

Thanks for the clarification. If I use OnPriceTick with OnChangedEvent handler and set the batchInterval throttle to 0, I am still not guaranteed to get all the trades ? I.e. Tick subscription is still superior to that method ?

Will subscribing to ticks as well as to quotes count against my subscription limit ? I am thinking of complementing both data feeds.


Thanks,

Brandon