Copy of algo-trader revision 556