API Support Forum
OEC API > Market Data > OnPriceChanged callback price of 0.00s for Spreads contracts
Author Topic: OnPriceChanged callback price of 0.00s for Spreads contracts
(2 messages, Page 1 of 1)
Moderators: VPfau
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Apr 14, 2015 @ 06:13 PM             Msg. 1 of 2
When I subscribe to a spreads contract, say GCL FTS +K5,-N5, like so:

oecapi.Subscribe(contract);

I often get back a single OnPriceChanged callback. The bid, ask, and last of that Price in that callback are 0.00.

I expect that this means there is no current quote available, because the last price of the last historical bar (daily or intraday) is -2.66.

If I were to use this Price quote, it would be terrribly inaccurate.

Unfortunately, 0.00 price quotes are completely valid for spreads contracts, as spreads contracts can have negative prices, even usually when the spread is of type FTS.

If you want to tell me that there are no quotes on the spread contract, I submit to you that I would need a Price object whose BAL were initted with some other value, say, -DBL_MAX, to know there is no quote available on this spreads chart.

Perhaps you have a better way of refusing these incorrect spreads quotes other than checking whether BAL are all 0.00? I think that in practice I could check whether BAL are all 0.00, because its highly unlikely that a Spreads FTS contract has valid BALs all of value 0.00. Yet, I'm sure this unlikely event will occur on occasion.

Thanks,
Edited by CWeber984 on Apr 14, 2015 at 18:27:55
Edited by CWeber984 on Apr 14, 2015 at 22:17:30
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Apr 14, 2015 @ 10:22 PM             Msg. 2 of 2
Further research reveals that any futures contract not in session has 0.0s returned in the OnPriceChanged callback's Price object for Bid, Ask, Last.

It seems these 0.0 values are like the OnBarsReceived callback where an array of Bars of size zero indicates we are done with some historical bars request.

In this case, the 0.0d out BidAskLast prices sound much like a flag that the contract is not in session. Again, its too bad 0.0 is a good price in spreads.

Thanks,

CHW