added unittests for trade entities and tables
refactoring and unittests