I'm developing a platform that is expecting to receive signals, process them, and react by sending its own signals. I haven't done this in C++ before so I'm wondering if you guys can point me where to look.
What sort of signals are we talking about? Where are they coming from? Where are they going?
Any real-time constraints? (See http://en.wikipedia.org/wiki/Real-time_computing )
What do you mean by "platform"?
Any sort of external signals. Pressing a button, receiving market quotes, receiving acknowledgements, etc...
It's very preliminary at the moment, but I would expect some sort of API that would receive such signals. Also I expect this signals can be received and processed within 1 milli-seconds. Typically, when my C++ code receive and process such signals, it would send out other signals such as updating tables, sending orders, etc..
I expect to implement the details before and after receiving the signals. However I would like to have some advice about the actual sending / receiving signals. I've read about boost:Signal2 package but I'm wondering if it is good for low latency real time processing.
It's a bit tough to give good advice with requirements as broad as "get a signal, process a signal, send a signal".
Signals can vary significantly. Generally they come from one of four sources:
1) Messages posted by the OS callback functions (like pressing a button)
2) Monitored changes in shared memory, modified by other processes
3) Network messages from other processes or machines.
4) Some other part of your application
You need to set up a listener for each case, that listener would call your processing logic, then you'd need to find a way to post your output to whomever listens. The method for sending a signal is the inverse of what you did to get the signal.
My in-signals are generally network messages or internal messages within the application. Shared memory are okay too but currently not in scope. Examples of network messages are Reuters quotes or news updates. My out-signals are also network messages going outbound. For example, alert messages to another PC or Apps.
Stewbond you are right about setting up listeners. I did that in another language but I want to learn a similar approach using C++. In the past I setup and manage listeners for market data, button click messages, etc... in real time, but I don't know how to do this via C++. Do you happen to have some link to such tutorials? Thanks in advance.
FYI this is a project on my own on low latency trading algorithm.