5

I'm working on an automatic trading system. What sorts of safe-guards should I have in place?

The main idea I have is to have multiple pieces checking each other.

I will have a second independent little process which will also connect to the same trading account and monitor simple things, like ensuring the total net position does not go over a certain limit, or that there are no more than N orders in 10 minutes for example, or more than M positions open simultaneously. You can also check that the actual open positions correspond to what the strategy process thinks it actually holds. As a bonus I could run this checker process on a different machine/network provider.

Besides the checks in the main strategy, this will ensure that whatever weird bug occurs, nothing really bad can happen.

Any other things I should monitor and be aware of?

Meh
  • 7,016
  • 10
  • 53
  • 76
  • I believe "safety critical" is generally used only when death or injury (rather than 'just' financial loss) would occur as a result of failure. – AakashM May 20 '10 at 15:34
  • 1
    "Besides the checks in the main strategy, this will ensure that whatever weird bug occurs, nothing really bad can happen." After what happened on May 6, I think it might be a good idea to have big red button that you can press to disconnect your black-box from the market, just in case! – James Webster May 21 '10 at 08:11
  • 1
    Infact many of the HFT shops like Tradeworx go dark when volatility gets to high. This causes the effect that was observed on May 6th where the bids disappeared from the market, removing liquidity. – Steve Severance May 21 '10 at 19:14
  • 1
    @James Webster: Make sure that red button is well tested too :P – monksy Sep 04 '10 at 03:50

1 Answers1

6

Alot of algorithmic trading systems make use of ESP/CEP (Event-stream processing/complex event processing) systems in order to make trading decision on the basis of market activity (tracking VWAP being the canonical example).

But perhaps you could create a stream from the algorithm's activity, and then have an ESP/CEP system use this stream to act as a watchdog over the algo's activity; if the algo starts trading too much within a rolling 10-minute window, it could send a message to your middleware to shutdown the FIX connection, etc. It would also be wise to monitor major indexes that you are trading against to see if the market is going through a particularly volatile moment... algos that trade well during periods of relative low volatility can quickly run amok when a market starts to crash.

Esper is an open-source ESP system for Java and .Net that is worth checking out.

James Webster
  • 4,046
  • 29
  • 41