use of name.abuchen.portfolio.snapshot.AssetCategory in project portfolio by buchen.
the class CurrencyTestCase method testAssetCategories.
private void testAssetCategories(GroupByTaxonomy grouping) {
AssetCategory cash = getAssetCategoryByName(grouping, "Barvermögen");
Money cashValuation = Money.of(CurrencyUnit.EUR, 1000_00 + Math.round(1000_00 * (1 / 1.1588)));
assertThat(cash.getValuation(), is(cashValuation));
AssetPosition positionEUR = getAssetPositionByName(grouping, accountEUR.getName());
assertThat(positionEUR.getValuation(), is(Money.of(CurrencyUnit.EUR, 1000_00)));
AssetPosition positionUSD = getAssetPositionByName(grouping, accountUSD.getName());
assertThat(positionUSD.getValuation(), is(Money.of(CurrencyUnit.EUR, Math.round(1000_00 * (1 / 1.1588)))));
Money equityEURvaluation = Money.of(CurrencyUnit.EUR, Math.round(20 * securityEUR.getSecurityPrice(grouping.getDate()).getValue() / Values.Quote.dividerToMoney()));
Money equityUSDvaluation = Money.of("USD", Math.round(10 * securityUSD.getSecurityPrice(grouping.getDate()).getValue() / Values.Quote.dividerToMoney())).with(converter.at(grouping.getDate()));
Money equityValuation = Money.of(CurrencyUnit.EUR, equityEURvaluation.getAmount() + equityUSDvaluation.getAmount());
AssetCategory equity = getAssetCategoryByName(grouping, "Eigenkapital");
assertThat(equity.getValuation(), is(equityValuation));
AssetPosition equityEUR = getAssetPositionByName(grouping, securityEUR.getName());
assertThat(equityEUR.getValuation(), is(equityEURvaluation));
AssetPosition equityUSD = getAssetPositionByName(grouping, securityUSD.getName());
assertThat(equityUSD.getValuation(), is(equityUSDvaluation));
assertThat(grouping.getValuation(), is(cashValuation.add(equityValuation)));
}
Aggregations