I have written some Java code (using the interactive brokers API) to poll for futures pricing every 50ms and when it's in a situation I like, it will purchase or sell X contracts, etc.
Timer t = new Timer( );
t.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
// get pricing, look for situational stuff
}
}, 0, 50);
However, I'm lost as to how to write the code to properly keep the program always running in the background. If it matters, I'm developing this on OS X and production environment can be either ubuntu or centOS