test_class.declarator: PERCENT_OFFSET = offset(0.000000000001d)
test_class.modifier: private static final
test_class.original_string: private static final Offset<Double> PERCENT_OFFSET = offset(0.000000000001d);
test_class.type: Offset<Double>
test_class.var_name: PERCENT_OFFSET
test_class.declarator: portofolioService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private PortofolioService portofolioService;
test_class.type: PortofolioService
test_class.var_name: portofolioService
test_class.declarator: portofolioRepo
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private PortofolioRepository portofolioRepo;
test_class.type: PortofolioRepository
test_class.var_name: portofolioRepo
test_class.file: trading-common/src/test/java/fr/ymanvieu/trading/common/portofolio/PortofolioServiceTest.java
test_class.identifier: PortofolioServiceTest
test_case.body: @Test
  	public void testGetOrderInfo_withSymbolOwned() {
  		String login = "seller";
  		String symbol = "UBI";
  
  		OrderInfo info = portofolioService.getOrderInfo(login, symbol, 1);
  
  		assertThat(info.getSelected().getSymbol().getCode()).isEqualTo(symbol);
  		assertThat(info.getSelectedCurrency().getSymbol().getCode()).isEqualTo(EUR);
  		assertThat(info.getGainCost()).isEqualByComparingTo("28.155001");
  	}
test_case.class_method_signature: PortofolioServiceTest.testGetOrderInfo_withSymbolOwned()
test_case.full_signature: @Test public void testGetOrderInfo_withSymbolOwned()
test_case.identifier: testGetOrderInfo_withSymbolOwned
test_case.invocations: getOrderInfo isEqualTo assertThat getCode getSymbol getSelected isEqualTo assertThat getCode getSymbol getSelectedCurrency isEqualByComparingTo assertThat getGainCost
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetOrderInfo_withSymbolOwned()
focal_class.declarator: userRepo
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private UserRepository userRepo;
focal_class.type: UserRepository
focal_class.var_name: userRepo
focal_class.declarator: portofolioRepo
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private PortofolioRepository portofolioRepo;
focal_class.type: PortofolioRepository
focal_class.var_name: portofolioRepo
focal_class.declarator: symbolRepo
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private SymbolRepository symbolRepo;
focal_class.type: SymbolRepository
focal_class.var_name: symbolRepo
focal_class.declarator: rateService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private RateService rateService;
focal_class.type: RateService
focal_class.var_name: rateService
focal_class.declarator: symbolMapper
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private SymbolMapper symbolMapper;
focal_class.type: SymbolMapper
focal_class.var_name: symbolMapper
focal_class.file: trading-common/src/main/java/fr/ymanvieu/trading/common/portofolio/PortofolioService.java
focal_class.identifier: PortofolioService
focal_class.class_method_signature: PortofolioService.createPortofolio(String login, String baseCurrencyCode, int baseCurrencyAmount)
focal_class.full_signature: public Portofolio createPortofolio(String login, String baseCurrencyCode, int baseCurrencyAmount)
focal_class.identifier: createPortofolio
focal_class.modifiers: public
focal_class.parameters: (String login, String baseCurrencyCode, int baseCurrencyAmount)
focal_class.return: Portofolio
focal_class.signature: Portofolio createPortofolio(String login, String baseCurrencyCode, int baseCurrencyAmount)
focal_class.class_method_signature: PortofolioService.getBaseCurrency(String login)
focal_class.full_signature: public AssetInfo getBaseCurrency(String login)
focal_class.identifier: getBaseCurrency
focal_class.modifiers: public
focal_class.parameters: (String login)
focal_class.return: AssetInfo
focal_class.signature: AssetInfo getBaseCurrency(String login)
focal_class.class_method_signature: PortofolioService.getPortofolio(String login)
focal_class.full_signature: public Portofolio getPortofolio(String login)
focal_class.identifier: getPortofolio
focal_class.modifiers: public
focal_class.parameters: (String login)
focal_class.return: Portofolio
focal_class.signature: Portofolio getPortofolio(String login)
focal_class.class_method_signature: PortofolioService.getAsset(AssetEntity ae)
focal_class.full_signature: protected AssetInfo getAsset(AssetEntity ae)
focal_class.identifier: getAsset
focal_class.modifiers: protected
focal_class.parameters: (AssetEntity ae)
focal_class.return: AssetInfo
focal_class.signature: AssetInfo getAsset(AssetEntity ae)
focal_class.class_method_signature: PortofolioService.getOrderInfo(String login, String symbolCode, double quantity)
focal_class.full_signature: public OrderInfo getOrderInfo(String login, String symbolCode, double quantity)
focal_class.identifier: getOrderInfo
focal_class.modifiers: public
focal_class.parameters: (String login, String symbolCode, double quantity)
focal_class.return: OrderInfo
focal_class.signature: OrderInfo getOrderInfo(String login, String symbolCode, double quantity)
focal_class.class_method_signature: PortofolioService.getAvailableSymbols(String login)
focal_class.full_signature: public List<Symbol> getAvailableSymbols(String login)
focal_class.identifier: getAvailableSymbols
focal_class.modifiers: public
focal_class.parameters: (String login)
focal_class.return: List<Symbol>
focal_class.signature: List<Symbol> getAvailableSymbols(String login)
focal_class.class_method_signature: PortofolioService.buy(String login, String code, double quantity)
focal_class.full_signature: public Order buy(String login, String code, double quantity)
focal_class.identifier: buy
focal_class.modifiers: public
focal_class.parameters: (String login, String code, double quantity)
focal_class.return: Order
focal_class.signature: Order buy(String login, String code, double quantity)
focal_class.class_method_signature: PortofolioService.sell(String login, String code, double quantity)
focal_class.full_signature: public Order sell(String login, String code, double quantity)
focal_class.identifier: sell
focal_class.modifiers: public
focal_class.parameters: (String login, String code, double quantity)
focal_class.return: Order
focal_class.signature: Order sell(String login, String code, double quantity)
focal_method.body: public OrderInfo getOrderInfo(String login, String symbolCode, double quantity) {
  
  		Objects.requireNonNull(symbolCode, "symbolCode is null");
  
  		SymbolEntity selectedSymbol = symbolRepo.findById(symbolCode).get();
  
  		if (selectedSymbol == null) {
  			throw SymbolException.UNKNOWN(symbolCode);
  		}
  
  		PortofolioEntity portofolio = portofolioRepo.findByUserUsername(login);
  
  		AssetEntity selectedAssetEntity = portofolio.getAsset(selectedSymbol.getCode());
  
  		if (selectedAssetEntity == null) {
  			selectedAssetEntity = new AssetEntity(portofolio, selectedSymbol, ZERO, portofolio.getCurrencyFor(selectedSymbol), ZERO);
  		}
  
  		String currencyCode = selectedAssetEntity.getCurrency().getCode();
  
  		Rate q = rateService.getLatest(selectedSymbol.getCode(), currencyCode);
  
  		AssetInfo selectedAsset = new AssetInfo(selectedAssetEntity.getSymbol(), selectedAssetEntity.getCurrency(),
  				selectedAssetEntity.getQuantity().doubleValue());
  
  		selectedAsset.setCurrentRate(q.getValue().doubleValue());
  
  		final AssetInfo selectedCurrency;
  
  		if (selectedAssetEntity.getCurrency().equals(portofolio.getBaseCurrency())) {
  			selectedCurrency = new AssetInfo(portofolio.getBaseCurrency(), null, portofolio.getAmount().doubleValue());
  		} else {
  			AssetEntity currencyAE = portofolio.getAsset(selectedAssetEntity.getCurrency().getCode());
  			selectedCurrency = new AssetInfo(currencyAE.getSymbol(), currencyAE.getCurrency(), currencyAE.getQuantity().doubleValue());
  		}
  
  		BigDecimal gainCost = null;
  
  		if (quantity != 0) {
  			gainCost = q.getValue().multiply(BigDecimal.valueOf(quantity));
  		}
  
  		return new OrderInfo(selectedAsset, selectedCurrency, gainCost);
  	}
focal_method.class_method_signature: PortofolioService.getOrderInfo(String login, String symbolCode, double quantity)
focal_method.full_signature: public OrderInfo getOrderInfo(String login, String symbolCode, double quantity)
focal_method.identifier: getOrderInfo
focal_method.invocations: requireNonNull get findById UNKNOWN findByUserUsername getAsset getCode getCurrencyFor getCode getCurrency getLatest getCode getSymbol getCurrency doubleValue getQuantity setCurrentRate doubleValue getValue equals getCurrency getBaseCurrency getBaseCurrency doubleValue getAmount getAsset getCode getCurrency getSymbol getCurrency doubleValue getQuantity multiply getValue valueOf
focal_method.modifiers: public
focal_method.parameters: (String login, String symbolCode, double quantity)
focal_method.return: OrderInfo
focal_method.signature: OrderInfo getOrderInfo(String login, String symbolCode, double quantity)