lundi 27 octobre 2014

IO2GResponseListener question

Hi,



I use ForexConnect C++ API, NonTableManager.

From time to time I get timeout errors, usually while trying to close a market order.

I am trying to understand now where is the mistake.



For example in sample at:

ForexConnectAPI\win32\samples\cpp\NonTableManagerSamples\CreateOrderBySymbol

the steps are simple:



1) create and subscribe a SessionStatusListener object

2) login

3) create and subscribe a ResponseListener object

4) get offer, get login rules, create order request, send request, wait, print result

5) unsubscribe registered ResponseListener

6) usubscribe registered SessionStatusListener



Can I consider the SessionStatusListener (1), and ResponseListener (3) persistent objects ?

Currently I create them only once during the same session (IO2GSession*)

At step (4) I keep the program alive with a while loop and a sleep 1sec, followed by possible calls: GetOffer, CreateMarketOrder, CloseMarketOrder, until CTRL-C is pressed, or console window closed.

The exit is done clean, with steps 5 and 6.



Should I preserve only the SessionStatusListener object and for each request should I create a new ResponseListener ?

Is it common thing to get disconnected ?

What is the best practice in this situation ? When I get a timeout , should I logout + login again ?

Approximately, at the time a dialog box popped out in TS2 announcing a webinar, I saw the timeout error in the console window executing on a separate computer without any TS2 installed.

Thanks.




Aucun commentaire:

Enregistrer un commentaire