refactoring trade protocol