API Support Forum
OEC API > Market Data > Volume and bid or ask
Author Topic: Volume and bid or ask
(18 messages, Page 1 of 1)
Moderators: VPfau
JWeissbard91
Posts: 21
Joined: Dec 18, 2007


Posted: Dec 18, 2007 @ 12:18 PM             Msg. 1 of 18
What would be the best way to get a trade the volume for that trade and to know if it was on the bis or on the ask.
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Dec 18, 2007 @ 01:07 PM             Msg. 2 of 18
best way to see trades only (not just changes in last price or volume) is subscribe for ticks ( OECClient.SubscribeTicks ). Note there's a strict limit on number of such subscriptions - max 10 per client. Ticks contain price and volume.

You can compare the tick price with best bid/ask price to determine whether it was a bid or ask.
JWeissbard91
Posts: 21
Joined: Dec 18, 2007


Posted: Dec 18, 2007 @ 01:21 PM             Msg. 3 of 18
Thanks. Follow up question, I see that SubscribeTicks has a date parameter, can I use now().

And I assume the event used to monitor this would be OnPriceTick, correct?
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Dec 18, 2007 @ 01:25 PM             Msg. 4 of 18
you can use UtcNow or any future time in UTC to make sure no historical ticks are received, and the event would be OnTicksReceived.
JWeissbard91
Posts: 21
Joined: Dec 18, 2007


Posted: Dec 18, 2007 @ 01:33 PM             Msg. 5 of 18
Thanks for the prompt reply. I see that OnTicksReceived gives me Subscribe and Ticks, how do I get best bid/ask price from that?
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Dec 18, 2007 @ 01:47 PM             Msg. 6 of 18
for best bid/ask price see Contract.CurrentPrice or cache price updates in your code.
alex118
Posts: 5
Joined: Aug 15, 2007


Posted: Dec 19, 2007 @ 02:40 PM             Msg. 7 of 18
How subscribe for ticks in VBA environment(code example)?
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Dec 19, 2007 @ 02:46 PM             Msg. 8 of 18
use OECClient.SubscribeTicks method.
JWeissbard91
Posts: 21
Joined: Dec 18, 2007


Posted: Dec 21, 2007 @ 07:59 AM             Msg. 9 of 18
Hi,
I'm running into the following scenario:
1) I get the bid and ask prices via OnPriceChange
2) The prices change
3) Before the OnPriceChange event fires the OnTicks event fires. This means that the prices I use to see if the Ticks was a Bid or Ask would be the old prices, not the updated one.

Is there anyway around this?
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Dec 21, 2007 @ 08:36 AM             Msg. 10 of 18
since all events are consecutive, you either receive price change first and then tick, or tick and then price change - there is no way to receive them both at the same time.

most likely, new tick will match bid/ask price of the last price update, but bid/ask update speed is throttled down, so there is no way to have 100% precision.
JWeissbard91
Posts: 21
Joined: Dec 18, 2007


Posted: Dec 21, 2007 @ 08:41 AM             Msg. 11 of 18
So there's no way to tell which set of Bid/Ask Prices a Tick belongs to?
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Dec 21, 2007 @ 08:51 AM             Msg. 12 of 18
no, there is no perfect way.
JWeissbard91
Posts: 21
Joined: Dec 18, 2007


Posted: Dec 21, 2007 @ 08:57 AM             Msg. 13 of 18
does that mean that the dome sometimes is not accurate?
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Dec 21, 2007 @ 09:01 AM             Msg. 14 of 18
number of bid/ask updates is limited to conserve bandwidth - so information received in onPriceUpdated is not 100% accurate - some updates can be skipped in fast moving market.

Tick updates are not limited.
JWeissbard91
Posts: 21
Joined: Dec 18, 2007


Posted: Dec 21, 2007 @ 09:04 AM             Msg. 15 of 18
would a OnDomchange be more accurate or the same a pricechange
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Dec 21, 2007 @ 09:07 AM             Msg. 16 of 18
No, DOM data is also throttled.
HKusumakar79
Posts: 21
Joined: Feb 18, 2008


Posted: Feb 19, 2008 @ 05:34 AM             Msg. 17 of 18
I have done the way you told. OnPriceChanged event i am subscribing with OECClient.Global.SubscribeTicks(contract,DateTime.UtcNow); and this works now OnTickReceived event firing and i am unsubscribing here after fatching data why bcoz there is limit for subscribtion is 5 so i am unsubscribing in OnTickReceived event but then also i am getting error msg that "Subscription limit of 5 is reached: no updates will be provided" so can you tell me where i am wrong?
HKusumakar79
Posts: 21
Joined: Feb 18, 2008


Posted: Feb 19, 2008 @ 05:50 AM             Msg. 18 of 18
I got the answer i have just removed subscriptiong from onPriceChanged events and i have subscribed for tick where i am subscribing for price changed and its working fine.