Search in sources :

Example 1 with AccountSnapshot

use of name.abuchen.portfolio.snapshot.AccountSnapshot in project portfolio by buchen.

the class CurrencyTestCase method testClientSnapshot.

@Test
public void testClientSnapshot() {
    LocalDate requestedTime = LocalDate.parse("2015-01-16");
    ClientSnapshot snapshot = ClientSnapshot.create(client, converter, requestedTime);
    AccountSnapshot accountEURsnapshot = lookupAccountSnapshot(snapshot, accountEUR);
    assertThat(accountEURsnapshot.getFunds(), is(Money.of(CurrencyUnit.EUR, 1000_00)));
    assertThat(accountEURsnapshot.getUnconvertedFunds(), is(Money.of(CurrencyUnit.EUR, 1000_00)));
    AccountSnapshot accountUSDsnapshot = lookupAccountSnapshot(snapshot, accountUSD);
    assertThat(accountUSDsnapshot.getFunds(), is(Money.of(CurrencyUnit.EUR, Math.round(1000_00 * (1 / 1.1588)))));
    assertThat(accountUSDsnapshot.getUnconvertedFunds(), is(Money.of("USD", 1000_00)));
    GroupByTaxonomy grouping = snapshot.groupByTaxonomy(client.getTaxonomy("30314ba9-949f-4bf4-944e-6a30802f5190"));
    testTotals(snapshot, grouping);
    testAssetCategories(grouping);
    testUSDAssetPosition(grouping);
}
Also used : ClientSnapshot(name.abuchen.portfolio.snapshot.ClientSnapshot) AccountSnapshot(name.abuchen.portfolio.snapshot.AccountSnapshot) LocalDate(java.time.LocalDate) GroupByTaxonomy(name.abuchen.portfolio.snapshot.GroupByTaxonomy) Test(org.junit.Test)

Aggregations

LocalDate (java.time.LocalDate)1 AccountSnapshot (name.abuchen.portfolio.snapshot.AccountSnapshot)1 ClientSnapshot (name.abuchen.portfolio.snapshot.ClientSnapshot)1 GroupByTaxonomy (name.abuchen.portfolio.snapshot.GroupByTaxonomy)1 Test (org.junit.Test)1