You start developing a serious algo when 80% of your code is about exceptions handling. Pretty much like any corporate solution. It is very easy to design a "happy path", but to cover every single path, that's another matter.
Triggering an order is something anyone can do. Acting when that...