TradeInfoService { public boolean isTradeExistsForInstrument(TradeableInstrument<N> instrument) { lock.readLock().lock(); try { for (K accountId : this.tradesCache.keySet()) { if (isTradeExistsForInstrument(instrument, accountId)) { return true; } } } finally { lock.readLock().unlock(); } return false; } 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 tradeExistsTest() { TradeInfoService<Long, String, Long> service = createService(); assertTrue(service.isTradeExistsForInstrument(new TradeableInstrument<String>("AUD_USD"))); assertFalse(service.isTradeExistsForInstrument(new TradeableInstrument<String>("AUD_CHF"))); }