Author |
Topic: AutoReconncet and RequestContracts, subscribe, subscribeDOM (6 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
AAnatoly Posts: 22 Joined: Jul 01, 2010 |
The question is regarding AutoReconncet feature
1. If connection issue occuires then OnDisconnectedEvent fired. 2. I was subscribed for 4 contracts for Price and DOM. After autoreconnect i got OnLoginCompleteEvent OECClient::Global->Contracts->Count is now 1 ( and not 4) and my question is: may I call again: - RequestContracts (for previously requested 4 contracts) - OECClient::Global->subscribe(contract); - OECClient::Global->subscribeDOM(contract); I tried to call RequestContracts, but then OnContractsChanged never called. 3. For some reason after autoreconnect I have feed Price update for one ocntract only. (Probably because i have open positions on this contract?) I do not receive DOM update for this contract as well. My login username is AAnatoly2 Last time disconnected from api.openecry.com today 20 minutes before this message/ Please, clarify how it should work. Regards, Anatoly Anatoly Gutnick Edited by AAnatoly on Jul 27, 2010 at 06:44:38 |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
After OnLoginCompleteEvent everything should be re-requested and re-subscribed the same way as it would be done for the first time.
You are right: OEC API subscribes automatically quotes for open positions. Quote: I tried to call RequestContracts, but then OnContractsChanged never called I see a bunch of processed contract requests for this time period from this username in our server logs. Victor Vins Software Developer |
||||
AAnatoly Posts: 22 Joined: Jul 01, 2010 |
I tried again.
After disconnect OnLoginCompleteEnent is called. Then we re-request 207 contracts as after regular Login. But OnContractsChanged never called after reconnect. Price update come to only one contract ESU0. Here are lgs of OEC client. 10:43:16.262 Dbg Reader Price PLogin to OEC Server 4.0.0.0 10:43:16.262 Dbg Reader Order Login to OEC Server 4.0.0.0 10:43:17.535 Dbg System #8 AAnatoly2 : Loading 10:43:17.723 Dbg System #8 AAnatoly2 : Loaded, API: 93.75ms, Client: 93.75ms 10:47:54.934 Dbg System #8 DOM ZBU0 : 733987.07:47:54.9185000 10:47:55.913 Dbg System #8 DOM EMDU0 : 733987.07:47:55.9185000 10:47:56.902 Dbg System #8 DOM ESU0 : 733987.07:47:56.9028750 10:47:57.913 Dbg System #8 DOM ESH1 : 733987.07:47:57.9185000 10:47:58.927 Dbg System #8 DOM M6EU0 : 733987.07:47:58.9341250 10:47:59.912 Dbg System #8 DOM NQU0 : 733987.07:47:59.9185000 10:48:00.912 Dbg System #8 DOM FSTXU0 : 733987.07:48:00.9185000 10:48:03.099 Dbg System #8 DOM M6EU0 : 00:00:04.3860000 10:48:04.663 Dbg System #8 DOM NQU0 : 00:00:03.4645000 10:48:06.758 Dbg System #8 DOM FSTXU0 : 00:00:06.0582500 10:48:07.320 Dbg System #8 DOM EMDU0 : 00:00:06.0577500 10:48:07.569 Dbg System #8 DOM ESH1 : 00:00:09.8707500 10:48:12.350 Dbg System #8 DOM EMDU0 : 00:00:03.2770000 10:48:13.757 Dbg System #8 DOM FSTXU0 : 00:00:06.2142500 10:48:15.991 Dbg System #8 DOM NQU0 : 00:00:04.6356250 10:48:16.288 Dbg System #8 DOM ZBU0 : 00:00:04.4015000 10:48:18.929 Dbg System #8 DOM EMDU0 : 00:00:06.7921250 10:48:22.164 Dbg System #8 DOM NQU0 : 00:00:03.0891250 10:48:23.241 Dbg System #8 DOM EMDU0 : 00:00:04.5422500 10:48:25.398 Dbg System #8 DOM NQU0 : 00:00:03.4635000 10:48:26.303 Dbg System #8 DOM FSTXU0 : 00:00:04.2607500 10:48:27.087 Dbg System #8 DOM ESH1 : 00:00:18.6520000 10:48:30.180 Dbg System #8 DOM EMDU0 : 00:00:03.0887500 10:48:30.183 Dbg System #8 DOM ESH1 : 00:00:03.1977500 10:48:30.304 Dbg System #8 DOM FSTXU0 : 00:00:04.2287500 10:48:34.182 Dbg System #8 DOM NQU0 : 00:00:03.7287500 10:48:37.976 Dbg System #8 DOM ZBU0 : 00:00:03.3856250 10:48:40.101 Dbg System #8 DOM M6EU0 : 00:00:29.7456250 10:48:40.147 Dbg System #8 DOM ESH1 : 00:00:03.1355000 10:48:40.383 Dbg System #8 DOM FSTXU0 : 00:00:06.3068750 10:48:51.589 Dbg System #8 DOM NQU0 : 00:00:05.8690000 10:48:53.353 Dbg System #8 DOM FSTXU0 : 00:00:09.2596250 10:48:54.336 Dbg System #8 DOM ZBU0 : 00:00:13.4160000 10:48:54.822 Dbg System #8 DOM NQU0 : 00:00:03.4623750 10:48:56.824 Dbg System #8 DOM EMDU0 : 00:00:11.0727500 10:49:00.460 Dbg System #8 DOM ZBU0 : 00:00:03.0723750 10:49:01.383 Dbg System #8 DOM FSTXU0 : 00:00:03.2122500 10:49:03.446 Dbg System #8 DOM NQU0 : 00:00:03.3377500 10:49:05.304 Dbg System #8 DOM EMDU0 : 00:00:05.7901250 10:49:05.444 Dbg System #8 DOM M6EU0 : 00:00:06.5877500 10:49:10.882 Dbg System #8 DOM EMDU0 : 00:00:05.5562500 10:49:17.104 Dbg System #8 DOM M6EU0 : 00:00:07.7590000 10:49:17.121 Dbg System #8 DOM NQU0 : 00:00:11.9156250 10:49:17.180 Dbg System #8 DOM EMDU0 : 00:00:03.2591250 10:49:24.289 Dbg System #8 DOM M6EU0 : 00:00:07.3525000 10:49:26.555 Dbg System #8 DOM NQU0 : 00:00:07.4151250 10:49:26.617 Dbg System #8 DOM EMDU0 : 00:00:08.5246250 10:49:26.961 Dbg System #8 DOM FSTXU0 : 00:00:03.2583750 10:49:28.632 Dbg System #8 DOM ESH1 : 00:00:48.5722500 10:49:36.463 Dbg System #8 DOM NQU0 : 00:00:03.3833750 10:49:36.477 Dbg System #8 DOM M6EU0 : 00:00:07.9620000 10:49:40.479 Dbg System #8 DOM FSTXU0 : 00:00:07.2430000 10:49:41.831 Dbg System #8 DOM NQU0 : 00:00:05.6023750 10:49:41.867 Dbg System #8 DOM ESH1 : 00:00:13.3366250 10:49:41.901 Dbg System #8 DOM EMDU0 : 00:00:12.5238750 10:49:47.899 Dbg System #8 DOM ZBU0 : 00:00:06.1798750 10:49:50.712 Dbg System #8 DOM NQU0 : 00:00:03.5703750 10:49:51.009 Dbg System #8 DOM FSTXU0 : 00:00:05.7732500 10:49:52.273 Dbg System #8 DOM M6EU0 : 00:00:16.0238750 10:49:52.820 Dbg System #8 DOM EMDU0 : 00:00:07.5707500 10:49:55.179 Dbg System #8 DOM M6EU0 : 00:00:03.1331250 10:49:55.692 Dbg System #8 DOM ESH1 : 00:00:13.2577500 10:50:06.606 Dbg System #8 DOM NQU0 : 00:00:04.3200000 10:50:10.263 Dbg System #8 DOM EMDU0 : 00:00:03.7412500 10:50:13.450 Dbg System #8 DOM M6EU0 : 00:00:06.4607500 10:50:21.544 Dbg Reader Order MainStream disconnected: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at OEC.CommLib.PacketSocket.ReadLen(Byte[] buf, Int32 length) at OEC.CommLib.PacketSocket.Read() at OEC.CommLib.ProtoSocket.Read[T]() at OEC.CommLib.ProtoClient`2.ReadLoop() 10:50:21.545 Dbg Reader Price PriceStream disconnected: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at OEC.CommLib.PacketSocket.ReadLen(Byte[] buf, Int32 length) at OEC.CommLib.PacketSocket.Read() at OEC.CommLib.ProtoSocket.Read[T]() at OEC.CommLib.ProtoClient`2.ReadLoop() 10:51:00.032 Dbg Reader Order Login to OEC Server 4.0.0.0 10:51:01.226 Dbg System #8 AAnatoly2 : Loading 10:51:01.284 Dbg System #8 AAnatoly2 : Loaded, API: 0ms, Client: 46.875ms 10:51:04.674 Dbg Reader Price PLogin to OEC Server 4.0.0.0 Anatoly Gutnick Edited by AAnatoly on Aug 4, 2010 at 03:58:21 Edited by AAnatoly on Aug 4, 2010 at 04:00:48 |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
I cannot reproduce it with slightly modified OECAPI Advanced Sample (enabled AutoReconnect, added OnContractsChanged handler with simple output to log). Can you check the same sample on your side?
Victor Vins Software Developer |
||||
AAnatoly Posts: 22 Joined: Jul 01, 2010 |
1. The same flow is working with 'OECAPI Advanced Sample'.
2. But in our application it is not working. I have all activity in trace. 1) OnLoginComplete is called after disconnect and at this moment: OECClient.Global.Contracts.Count == 1 2) RequestContracts is called 3) OnContractsChanged is never called any more. I tried to find in OECAPI log file any info: - RequestContracts trace; - OnContractsChanged trace; Questions: 1. Do you see RequestContracts on server side? 2. If so then probalby OnContractsChanged is not called due some threading issue. But PriceUpdate callback is called for one contract that was availible when OnLoginComplete is called without Request. Any idea? 3. What AutoReconnect feature provide? We still need to Re-Request and Re-Subscribe - this is not done Automatically. So, it is only automaticaly re-login that can be done by application? What about orders? (OECClient.Global.Orders.Values - this will be loaded automatically after Relogin?) Anatoly Gutnick |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
Yes, I see processed contract requests from your application and from Advanced Sample in server logs.
I cannot help with potential issue in your application with multi-threading, because of lack of information about your application. Please compare your application and Advanced Sample to figure out the reason. Auto-reconnection just reconnects disconnected connections. Quote: So, it is only automaticaly re-login that can be done by application? Not sure what do you mean. Quote: What about orders? (OECClient.Global.Orders.Values - this will be loaded automatically after Relogin?) OECAPI doesn't provide "request functionality" for orders, positions and accounts. So, automatic reloading is only option. Victor Vins Software Developer |
||||