API Support Forum
OEC API > API Support > Subscribe vs SubscribeTicks vs RequestTicks
Author Topic: Subscribe vs SubscribeTicks vs RequestTicks
(4 messages, Page 1 of 1)
Moderators: VPfau
TLau471
Posts: 70
Joined:


Posted: May 27, 2016 @ 10:00 AM             Msg. 1 of 4
What's the difference between these methods?
I'm looking to get the tick stream and the total volume

Subscribe gives me Subscription.Contract.CurrentPrice.TotalVol
but SubscribeTicks gives Subscription.Contract.CurrentPrice as Null/Nothing.

Furthermore, why doesn't Subscribe return a Subscription criteria like the rest of the SubscribeXXX methods?

TLau

Edited by TLau471 on May 27, 2016 10:14 AM
NShine
Posts: 36
Joined:


Posted: May 31, 2016 @ 09:27 AM             Msg. 2 of 4
Hello,

SubscribeTicks sets up an ongoing subscription to receive tick data for a given contract. You will need to cancel this subscription to stop ticks from being sent.

RequestTicks requests a range of ticks to return. Once the requested data has been sent to the client, no more will ticks will be sent. No cancellation is required for this method.

Subscribe sets up a price (quote) subscription. If you are receiving bar or tick data for a contract, you will already have a price subscription. No Subscription object is returned because to cancel you just need to use the more generic method Unsubscribe.

Don't forget, tick/price data is not returned in the Subscription object. You need to listen to the events being raised for each type of request (e.g., OnTicksReceived).

Please refer to our API documentation. You might be interested in the Market Data section.

http://www.gainfutures.com/api/api/
TLau471
Posts: 70
Joined:


Posted: May 31, 2016 @ 10:56 AM             Msg. 3 of 4
Hi,

Thanks. I'm clear about the difference between the 3 now. Is there a way to get TotalVol when using SubscribeTicks?
TLau
NShine
Posts: 36
Joined:


Posted: May 31, 2016 @ 11:20 AM             Msg. 4 of 4
TotalVol is not returned during OnTicksReceived. You should be able to access the current TotalVol in your OECClient.Global.Contracts["SYMBOL"].CurrentPrice, or listen to the OnPriceChanged event to catch it when it changes.