My systems use market (not limit) orders so they are very time sensitive. But I keep getting messed up because C2 sometimes does not respond to my signals. Sometimes C2 seems to go to sleep or the server goes off-line. My systems usually trade overnight. I don’t get any ‘error’ or ‘accepted’ response. My system has sent STC signals which were never accepted. When I realized the position was not closed on C2 then my position was already at a big loss so I had to manually re-create the HTML signals and transmit the STC to C2 finally getting the position to close at C2 but with a big loss. Another time I had sent a BTO signal but C2 didn’t respond. So after a few minutes I re-sent the signal. Then a few minutes later my system’s page on the C2 website showed that I had bought twice and I had to manually create a STC HTML string to sell one of the positions. I have modified my program to wait 3 seconds and then re-send the signal but C2 does not check for duplicate ids so this could result in additional orders. Do I have to write a lot of ‘reconciliation’ code?
My main question is that: What is the “&signalid=” for? C2 does not check if this is a duplicate order ID. I could send a hundred orders with the same id and C2 would accept them all. The C2 documentation says “if you create your own signal id, you must guarantee its uniqueness within your own trading system, across eternity”. But it does not seem to matter if it is a duplicate id.
Is there a way to ‘wake-up’ C2 and make sure it is awake and listening and the server is up before sending a trading signal? Do I just keep sending dummy HTML strings to C2 every second and checking for responses to make sure that C2 is awake and listening and ready?
Other developers must have the same problems so what is the solution? Suggestions please!
Do not send signals every 1 second to “wake up” c2. C2 is awake, Warren. I assure you.
If you are using HTTP to send a signal, you can see whether you get a valid response back. C2 will tell you whether it accepts your signal with no problem.
If there is a problem you will receive an error via the HTTP header (in the case of a server that does not respond) or within the XML in the case of a C2-generated error.
C2 does check for uniqueness in API URL calls, but only over a very brief time window (approx 10 seconds).
It’s very hard to give you any more specific advice because your question didn’t contain a lot of specific information. What might help is if we can track the specific problems you have, and the specific dates, times, and time zones when those problems occur. It would also help to know the exact URL you are GETting at the time you have a problem.
So a very helpful way to move forward would be if you could email me a specific case like this:
"At 12:24 PM ET on May 18, I tried this URL:
http://www.collective2.com/cgi-perl/signal.mpl?blahBlah=bleh
and I received no response after I waited for 28 seconds."
Or whatever.
Then I can compare the server logs to what you are saying and we can come up with an answer.
I should further add that when I gave the server logs a quick look, I saw a lot of weird stuff going on in at least one of your systems:
You are sending orders multiple times with the same signal id.
You are sending orders which are being rejected due to lack of sufficient margin.
Are you parsing the XML in the C2 responses coming back, or are you just firing off the signals? Perhaps the problem is that you are not aware that your signals are being rejected for insufficient margin? Just a guess, but let’s work through the details to find out.
My following signals got no response (no ‘accepted’, no ‘error’, no nothing) from C2. My app looks for a ‘accepted’ in the return XML string but in these cases I didn’t get any return string:
5/3/2011 9:30:42 AM 9627
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=59618192&pw=XXXXXX&instrument=future&action=STC&quant=1&symbol=@NQM1&duration=GTC&signalid=9627
5/3/2011 9:30:43 AM 9627
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=59618192&pw=XXXXXX&instrument=future&action=STC&quant=3&symbol=@NQM1&duration=GTC&signalid=9627
5/4/2011 6:55:24 PM 9628
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=38125396&pw=XXXXXX&instrument=future&action=STC&quant=1&symbol=@NQM1&duration=GTC&signalid=9628
5/4/2011 6:57:37 PM 9628
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=38125396&pw=XXXXXX&instrument=future&action=STC&quant=1&symbol=@NQM1&duration=GTC&signalid=9628
5/4/2011 7:05:40 PM 9628
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=59618192&pw=XXXXXX&instrument=future&action=BTO&quant=1&symbol=@NQM1&duration=GTC&signalid=9628
I gave up C2 for a few weeks, then started again and got another ‘no response’ from this signal:
5/16/2011 2:31:37 PM 9628
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=59618192&pw=XXXXXX&instrument=future&action=BTO&quant=1&symbol=@NQM1&duration=GTC&signalid=9628
The ‘signalid=’ doesn’t matter.
I have added more error logging to my app so I can get you more data in the future.
- The documentation explicitly says you must make your signalids unique. If you want to assign your own (you do not have to), then make them unique. Otherwise C2 will ignore them.
2) You are polling for positionstatus way too much and C2 will gradually degrade performance for systems that wildly overuse resources. That’s not the reason we are ignoring your signals in this case (#1 above, is) but just an FYI.
OK, so now I have eliminated the ’ &signalid=’ so I should always get responses from C2 from now on. I also changed positionstatus check to each hour.
Now I should be all OK and no missed signals.
I sent signals this morning but they were not accepted. Why not? Didn’t get any response from C2. Now I am at a big loss. My Internet is connected and I can Google. See below:
5/23/2011 9:30:40 AM 10045
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=59618192&pw=smiwar631&instrument=future&action=STC&quant=2&symbol=@NQM1&duration=GTC
5/23/2011 9:31:05 AM C2 Connection problem
5/23/2011 9:31:13 AM C2 - not accepted - resending
5/23/2011 9:31:13 AM 10045
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=59618192&pw=smiwar631&instrument=future&action=STC&quant=2&symbol=@NQM1&duration=GTC
5/23/2011 9:31:45 AM C2 - not accepted - resending
5/23/2011 9:31:45 AM 10045
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=59618192&pw=smiwar631&instrument=future&action=STC&quant=2&symbol=@NQM1&duration=GTC
5/23/2011 9:32:18 AM C2 - not accepted - resending
5/23/2011 9:32:18 AM 10045
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=59618192&pw=smiwar631&instrument=future&action=STC&quant=2&symbol=@NQM1&duration=GTC
5/23/2011 9:32:51 AM C2 - not accepted - resending
5/23/2011 9:32:51 AM 10045
https://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=59618192&pw=smiwar631&instrument=future&action=STC&quant=2&symbol=@NQM1&duration=GTC
5/23/2011 9:33:23 AM C2 - not accepted - resending
Looks like C2 closed 22 of my positions this morning and I was only trying to close 2. Didn’t get any responses from C2 so my system kept trying to sell the 2 positions.
Please see my response in the other thread you simultaneously opened.