refactor tradestats