TradeInfoService { public Collection<Trade<M, N, K>> getTradesForAccount(K accountId) { Map<TradeableInstrument<N>, Collection<Trade<M, N, K>>> tradesForAccount = this.tradesCache.get(accountId); Collection<Trade<M, N, K>> trades = Lists.newArrayList(); synchronized (tradesForAccount) { if (TradingUtils.isEmpty(tradesForAccount)) { return trades; } for (Collection<Trade<M, N, K>> tradeLst : tradesForAccount.values()) { trades.addAll(tradeLst); } } return trades; } TradeInfoService(TradeManagementProvider<M, N, K> tradeManagementProvider,
			AccountDataProvider<K> accountDataProvider); Collection<K> findAllAccountsWithInstrumentTrades(TradeableInstrument<N> instrument); @PostConstruct void init(); int findNetPositionCountForCurrency(String currency); Collection<Trade<M, N, K>> getAllTrades(); Collection<Trade<M, N, K>> getTradesForAccountAndInstrument(K accountId, TradeableInstrument<N> instrument); Collection<Trade<M, N, K>> getTradesForAccount(K accountId); void refreshTradesForAccount(K accountId); boolean isTradeExistsForInstrument(TradeableInstrument<N> instrument);  }
@Test public void tradesForAccountTest() { TradeInfoService<Long, String, Long> service = createService(); Collection<Trade<Long, String, Long>> allTradesAcc1 = service .getTradesForAccount(TradingTestConstants.accountId); assertEquals(3, allTradesAcc1.size()); Collection<Trade<Long, String, Long>> allTradesAcc2 = service .getTradesForAccount(TradingTestConstants.accountId2); assertEquals(4, allTradesAcc2.size()); }