Author |
Topic: Volume and bid or ask (18 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
JWeissbard91 Posts: 21 Joined: Dec 18, 2007 |
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 |
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 |
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 |
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 |
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 |
for best bid/ask price see Contract.CurrentPrice or cache price updates in your code.
|
||||
alex118 Posts: 5 Joined: Aug 15, 2007 |
How subscribe for ticks in VBA environment(code example)?
|
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
use OECClient.SubscribeTicks method.
|
||||
JWeissbard91 Posts: 21 Joined: Dec 18, 2007 |
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 |
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 |
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 |
no, there is no perfect way.
|
||||
JWeissbard91 Posts: 21 Joined: Dec 18, 2007 |
does that mean that the dome sometimes is not accurate?
|
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
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 |
would a OnDomchange be more accurate or the same a pricechange
|
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
No, DOM data is also throttled.
|
||||
HKusumakar79 Posts: 21 Joined: Feb 18, 2008 |
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 |
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.
|
||||