added p2ptrade.Agent tests and bugfixes