p2ptrade refactoring