class PortofolioService {

	public List<Symbol> getAvailableSymbols(String login) {

		PortofolioEntity portofolio = portofolioRepo.findByUserUsername(login);

		List<SymbolEntity> ownedCurrencies = portofolio.getCurrencies();
		List<SymbolEntity> ownedAssets = portofolio.getAssets().stream().map(a -> a.getSymbol()).collect(toList());

		BooleanExpression exp = symbolEntity.notIn(ownedAssets) //
				.and(symbolEntity.notIn(ownedCurrencies)) //
				.and(symbolEntity.currency.in(ownedCurrencies) //
						.and(symbolEntity.code.in(select(pairEntity.source.code).from(pairEntity))) //
						.or(symbolEntity.currency.isNull()));

		return symbolMapper.mapToSymbols(symbolRepo.findAll(exp, symbolEntity.code.asc()));
	}

}