API Support Forum
OEC API > API Support > OnTicksReceivedEvent not firing on DEMO server
Author Topic: OnTicksReceivedEvent not firing on DEMO server
(10 messages, Page 1 of 1)
Moderators: VPfau
JGagnon
Posts: 95
Joined: Apr 11, 2011


Posted: Nov 11, 2013 @ 01:04 AM             Msg. 1 of 10
We were able to subscribe for tick/volume data on DEMO server up until last Sunday and then we started receiving an error similar to Unsupported Software (I don't remember the error exactly). We were able to properly set our UUID and our program ran on DEMO server without any problems. However the OnTicksReceivedEvent stopped firing for the contracts we subscribed to. Can someone take a look at this please and let me know when this issue has been fixed?

We are subscribing for multiple contracts using the code below.

private void oecClient1_OnSymbolLookupReceived(OEC.API.SymbolLookupCriteria SymbolLookup, OEC.API.ContractList Contracts)
{
try
{
Global.ContractList.AddRange(Contracts);

foreach(var contract in Contracts)
{
var tempContract = contract;
var workingContract = Global.WorkingContracts.Where(i => i.Name == tempContract.Symbol);
if(workingContract.Any())
{

TickSubscription = OECClient.Global.SubscribeTicks(contract, workingContract.FirstOrDefault().LastRunTIme);

Global.TickSubscriptions.Add(TickSubscription);
}

}
}
catch (Exception ex)
{
string mySubject = "Data Feed";
string myBody = "oecClient1_OnSymbolLookupReceived [" + ex.Message + "]";
int SMS = 0;

DatabaseWrapper.OHLCSendMail(mySubject, myBody, SMS);
}
}

and we creating our stub to receive the ticks using the code below:

new OEC.API.OnTicksReceivedEvent(this.oecClient1_OnTicksReceived);

However when we debug the code, the above event is never trapped by a breakpoint.

John Gagnon
CMicciche902
Posts: 348
Joined:


Posted: Nov 11, 2013 @ 10:43 AM             Msg. 2 of 10
UUID was not being sent in SIM server. As of this weekend, we now enforce UUID key for all API connections on public DEMO server. This requirement has been in force for Developer server for several months.

Please ensure this UUID key is sent, else your connection will be prohibited and will receive error "Software not Permitted."

Once you have sent UUID key, please re-test your application.

Chris M
JGagnon
Posts: 95
Joined: Apr 11, 2011


Posted: Nov 11, 2013 @ 10:48 AM             Msg. 3 of 10
Thanks Chris -

We realized we did not have UUID properly set. The UUID change in the code was made a week ago and we are able to login and stay logged.

The problem we have now however is no tick subscription data on DEMO is being received via the event in my first post.

Thanks,
-jg

John Gagnon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Nov 13, 2013 @ 04:44 PM             Msg. 4 of 10
Could you send me username that you used in tests without ticks?

Victor Vins
Lead Software Developer
JGagnon
Posts: 95
Joined: Apr 11, 2011


Posted: Nov 13, 2013 @ 07:12 PM             Msg. 5 of 10
Hi Victor -

I don't think it should be isolated to a particular login, you can look up our login for our company Old House Landing Company - we were able to access tick data prior to the code change that was released to start requiring UUID in the code, so it looks like the bug was introduced with that code release. After the UUID change was made on the server our code that collected tick data stopped working.

It seems to be a bug on the server side. If you download your sample OEC Example (the simple one, not the advanced). Then if you run it, and enter a buy at market for 1 contract for ESZ3, if you look in Visual Studio in the Output window you will notice that no events are firing for Tick Received (no lines are written to console, you can set a breakpoint as well and it will not get trapped). The price change data events are being captured and changing in the status bar of the sample application. To get it to work you cancomment out this line:

oecClient1.Subscribe( c );

and uncomment the line below that follows in the code snippet below, and it will work. I figured this out by testing your advanced example and it seems to work using this code syntax.



/// <summary>
/// When user selects a contract, it displays current price or subscribe for it.
/// </summary>
private void cbContract_SelectionChangeCommitted( object sender, EventArgs e )
{
OEC.API.Subscription TickSubscription = null;
OEC.API.Contract c = cbContract.SelectedItem as OEC.API.Contract;
if( c != null )
{
if( c.CurrentPrice == null )
oecClient1.Subscribe( c );
// TickSubscription = OEC.API.OECClient.Global.SubscribeTicks(c, DateTime.UtcNow.AddMinutes(-10));
else
UpdatePrice( c );
}
}


The problem I am having is in our test application that connects to our DB etc... we are using the code that was originally commented out above and it is still not working.

So it looks like I need to recode the application from scratch using the simple OEC example I mentioned above. If you guys spot a bug on your side and think you have a fix just post a reply here and I can test it again.

John Gagnon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Nov 13, 2013 @ 08:30 PM             Msg. 6 of 10
We had no release in SIM over weekend. UUID code was in place for over a year, just not everybody was checked.

I followed your instructions and successfully got ticks in Advanced Example and quote updates in Basic without changes in code, OEC Trader uses the same OECAPI and gets both ticks and quotes. So, my username works fine. I will try to find out what usernames do you use to check server logs.

Victor Vins
Lead Software Developer
JGagnon
Posts: 95
Joined: Apr 11, 2011


Posted: Nov 13, 2013 @ 09:55 PM             Msg. 7 of 10
Quote: We had no release in SIM over weekend. UUID code was in place for over a year, just not everybody was checked.

I followed your instructions and successfully got ticks in Advanced Example and quote updates in Basic without changes in code, OEC Trader uses the same OECAPI and gets both ticks and quotes. So, my username works fine. I will try to find out what usernames do you use to check server logs.

--- Original message by VictorV on Nov 13, 2013 08:30 PM
Hi Victor -

Yes Quote updates works in basic example, this is because it is using the oecClient1_OnPriceChanged event to update the price.

HOWEVER, the output window should be showing whenever there is a new tick and it is not. You can set a breakpoint on function: oecClient1_OnTicksReceived and it will never fire until you make the code change I mentioned in my previous post.

I'm curious why my test app stopped working on DEMO until I added the UUID if no code has changed on the backend.

Regards,
-jg

John Gagnon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Nov 13, 2013 @ 10:10 PM             Msg. 8 of 10
oecClient1_OnTicksReceived is raised only for tick subscriptions. Original source code of Basic example does not have any attempt to subscribe to ticks. This event handler was left from some internal tests. As result, debugger is not supposed to be stopped on a breakpoint inside this handler.

Victor Vins
Lead Software Developer
JGagnon
Posts: 95
Joined: Apr 11, 2011


Posted: Nov 13, 2013 @ 10:27 PM             Msg. 9 of 10
Ok, I guess this code which gets executed is for price update subscription or something?

oecClient1.Subscribe( c );

John Gagnon
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Nov 13, 2013 @ 11:04 PM             Msg. 10 of 10
Subscribe method is just for price update subscription and lead to raising OnPriceChanged and OnPriceTick events only

Victor Vins
Lead Software Developer