API Support Forum
OEC API > API Support > SubscribeBars not working?
Author Topic: SubscribeBars not working?
(12 messages, Page 1 of 1)
Moderators: VPfau
KZetterstrom
Posts: 6
Joined: Jun 22, 2011


Posted: Sep 20, 2011 @ 06:29 PM             Msg. 1 of 12
I am trying to use SubscribeBars to keep updated with a contracts bar history. I have tried both:

oecClient1.SubscribeBars(contract, DateTime.Now, OEC.Data.SubscriptionType.Bar, 3);

and the new overload

oecClient1.SubscribeBars(contract, 41, OEC.Data.SubscriptionType.Bar, 3, false);

to get 3 minute bar intervals for my OEC.API.Contract contract.


With both of these calls, I am getting an oecClient1_OnBarsReceived() function to fire just ONCE, which happens immediately after my call to SubscribeBars(). Shouldn't the SubscribeBars() functions send me bars on my bar interval? I thought I would hit the oecClient1_OnBarsReceived() every 3 minutes but I am not.

Please help!
Thanks

Kevin Zetterstrom
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Sep 20, 2011 @ 08:27 PM             Msg. 2 of 12
What contract do you use? Is it liquid? Actually, OnBarsReceived should be raised on every update of the last bar that can be much often than 3 minutes.

Victor Vins
Lead Software Developer
KZetterstrom
Posts: 6
Joined: Jun 22, 2011


Posted: Sep 20, 2011 @ 08:35 PM             Msg. 3 of 12
I tried several contracts. EMU1, 6CZ1, 6JZ1, 6AZ1. A few others too. None seemed to work. I can use requestBars for these and I get the bars that way through OnBarsReceived. Thoughts?

Kevin Zetterstrom
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Sep 20, 2011 @ 08:56 PM             Msg. 4 of 12
Could you please reproduce it and send me username, contract and timestamp of the issue? I will research the issue in server logs.

Victor Vins
Lead Software Developer
KZetterstrom
Posts: 6
Joined: Jun 22, 2011


Posted: Sep 20, 2011 @ 09:07 PM             Msg. 5 of 12
Username: KZetterstrom
Contract: 6AZ1
Time at SubscribeBars() call: 9:02:xx Eastern Standard Time. xx is somewhere between 3-30 seconds, not exactly sure.

Kevin Zetterstrom
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Sep 21, 2011 @ 09:15 AM             Msg. 6 of 12
Nothing wrong in server logs. I've checked it in a sample program - updates are coming as expected. Could you please send me a sample code to reproduce it on my side?

Victor Vins
Lead Software Developer
KZetterstrom
Posts: 6
Joined: Jun 22, 2011


Posted: Sep 21, 2011 @ 05:12 PM             Msg. 7 of 12
PM Sent

Kevin Zetterstrom
TDecilveo930
Posts: 7
Joined: May 11, 2011


Posted: Sep 23, 2011 @ 07:48 AM             Msg. 8 of 12
Any luck? I am very confused as to why I am not hitting the OnBarsReceived function

Timothy Decilveo
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Sep 23, 2011 @ 08:12 AM             Msg. 9 of 12
Timothy, could you please send me your code? I hope we resolved the issue with Kevin's code.

Victor Vins
Lead Software Developer
TDecilveo930
Posts: 7
Joined: May 11, 2011


Posted: Sep 23, 2011 @ 08:16 AM             Msg. 10 of 12
Victor, I don't know why my user name is showing up as TDecilveo930, I am logged in as KZetterstrom...

In either case, Timothy is my client, I (Kevin) am his developer. So yes, the code I sent you is still not working.

Timothy Decilveo
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Sep 23, 2011 @ 08:32 AM             Msg. 11 of 12
Hmm. Did you receive my response in Private Message?

It looks like you expect than every time OnBarsReceived will be called with the whole history of bars, is it correct? Actually, it is called with new bars or just a single last bar in the case of updates.

Victor Vins
Lead Software Developer
TDecilveo930
Posts: 7
Joined: May 11, 2011


Posted: Sep 23, 2011 @ 08:50 AM             Msg. 12 of 12
I can't figure out how to see my private messages...

But yes, I was expecting more than 1 bar in OnBarsReceived. I thought that's what the new overload for SubscribeBars would do with the Amount field, which is why I passed in 41. I thought I would get the last 40 bars.

I will modify the code at some point today, run it, and let you know how that goes.

Timothy Decilveo