Refactoring and creating tests for the Database
Changed to leave connection open
Updated tests. Added cached trades