TradeInfoService { public Collection<Trade<M, N, K>> getTradesForAccountAndInstrument(K accountId, TradeableInstrument<N> instrument) { Map<TradeableInstrument<N>, Collection<Trade<M, N, K>>> tradesForAccount = this.tradesCache.get(accountId); synchronized (tradesForAccount) { if (!TradingUtils.isEmpty(tradesForAccount) && tradesForAccount.containsKey(instrument)) { return Lists.newArrayList(tradesForAccount.get(instrument)); } } return Collections.emptyList(); } 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 allTradesForAccountAndInstrumentTest() { TradeInfoService<Long, String, Long> service = createService(); Collection<Trade<Long, String, Long>> trades = service.getTradesForAccountAndInstrument( TradingTestConstants.accountId, new TradeableInstrument<String>("USD_JPY")); assertFalse(trades.isEmpty()); trades = service.getTradesForAccountAndInstrument(TradingTestConstants.accountId, new TradeableInstrument<String>("USD_CHF")); assertTrue(trades.isEmpty()); }