algotrader refactoring