API Support Forum
OEC API > API Support > auto reconnect option
Author Topic: auto reconnect option
(9 messages, Page 1 of 1)
Moderators: VPfau
JPaganini258
Posts: 16
Joined: Oct 28, 2011


Posted: Nov 29, 2011 @ 07:48 AM             Msg. 1 of 9
Hi, in order to get my symbol watches keeping watching after reconnect, what I need to do?

I'm connecting and watching a symbol. The problem is that after the market close, it auto-disconnect, and connect again when the server came back.

If there's a parameter auto-connect, last parameter on OECClient login method, why it doesn't keep the current API session? I really wait these behaviour. What I'm doing wrong?

For a while, I'll re-subscribe all symbol watches onLoginComplete method. But, these behaviour is right?

Jônatas Paganini
RuslanK
Posts: 69
Joined: Jun 02, 2010


Posted: Nov 29, 2011 @ 08:01 AM             Msg. 2 of 9
Hello,

The AutoReconnect parameter is used only for case when disconnection is initiated by OEC side - in this case API tryes to reconnect automatically and all watched contracts will be re-subscribed.

If your application initates disconnection itself - then it's responsible to keep "API session" and subscribe for previously subscribed contracts again.

Ruslan Kartokhin
Software Developer
JPaganini258
Posts: 16
Joined: Oct 28, 2011


Posted: Nov 29, 2011 @ 08:02 AM             Msg. 3 of 9
I'm looking on my code and the error is yours. I really don't know why, but, after onLoginComplete, I send oecClient.symbolLookup("6SZ1") and doesn't start sending ticks.

I think my command was ignored because the market is closed or something like that. Can you verify it for me?


How can I fix these? I really want to send my symbol look up one time.

Thanks

Jônatas Paganini
RuslanK
Posts: 69
Joined: Jun 02, 2010


Posted: Nov 29, 2011 @ 08:10 AM             Msg. 4 of 9
Seems like you're confusing intention of this method.
Please read the description of OECClient.SymbolLookup method below:
"Sends strict symbol lookup request to server. Results will be available via event OnSymbolLookupReceived. The result will contains only one contract with name that starts with Symbol"

This method is not intended to subscribe ticks, but to request contract information instead.
To subscribe ticks please use SubscribeTicks method.

Ruslan Kartokhin
Software Developer
JPaganini258
Posts: 16
Joined: Oct 28, 2011


Posted: Nov 29, 2011 @ 08:13 AM             Msg. 5 of 9
My application doesn't trying to disconnect anytime.

Jônatas Paganini
RuslanK
Posts: 69
Joined: Jun 02, 2010


Posted: Nov 29, 2011 @ 08:18 AM             Msg. 6 of 9
If you will use proper method to subsribe ticks - API will resubscribe to contracts automatically.
Once again - SymbolLookup cannot be used to subscribe ticks.

Ruslan Kartokhin
Software Developer
RuslanK
Posts: 69
Joined: Jun 02, 2010


Posted: Nov 29, 2011 @ 08:47 AM             Msg. 7 of 9
Then please pay your attention to the fact that your application will not receive any ticks until market opens again (previously you said it happens after market close).

Also, you can do a simple test - request symbol, subscribe to ticks then plug-off your network cable from your PC (or use any other method to drop connection) and then put it back - API will reconnect automatically and you should see ticks coming for previously subscribed contract.

Ruslan Kartokhin
Software Developer
RuslanK
Posts: 69
Joined: Jun 02, 2010


Posted: Nov 29, 2011 @ 03:20 PM             Msg. 8 of 9
My apologizes - seems like we do have the issue here:

Currently reconnection do not support automatic re-subscription for previously subscribed contracts.
The only exclusion - is automatic quotes subscription for contracts which do have open positions.

Sorry for misinformation.
We will put a task about proper behaviour during auto-reconnect into our development queue but for the time being please keep using your workaround.

Ruslan Kartokhin
Software Developer