Search in sources :

Example 6 with SecurityPosition

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

the class SecurityPerformanceSnapshot method addPseudoValuationTansactions.

private static void addPseudoValuationTansactions(Portfolio portfolio, CurrencyConverter converter, ReportingPeriod period, Map<Security, SecurityPerformanceRecord> records) {
    PortfolioSnapshot snapshot = PortfolioSnapshot.create(portfolio, converter, period.getStartDate());
    for (SecurityPosition position : snapshot.getPositions()) {
        records.get(position.getSecurity()).addTransaction(new DividendInitialTransaction(position, period.getStartDate().atStartOfDay()));
    }
    snapshot = PortfolioSnapshot.create(portfolio, converter, period.getEndDate());
    for (SecurityPosition position : snapshot.getPositions()) {
        records.get(position.getSecurity()).addTransaction(new DividendFinalTransaction(position, period.getEndDate().atStartOfDay()));
    }
}
Also used : SecurityPosition(name.abuchen.portfolio.snapshot.SecurityPosition) PortfolioSnapshot(name.abuchen.portfolio.snapshot.PortfolioSnapshot)

Aggregations

SecurityPosition (name.abuchen.portfolio.snapshot.SecurityPosition)6 CurrencyConverter (name.abuchen.portfolio.money.CurrencyConverter)4 CurrencyConverterImpl (name.abuchen.portfolio.money.CurrencyConverterImpl)3 PortfolioSnapshot (name.abuchen.portfolio.snapshot.PortfolioSnapshot)3 BigDecimal (java.math.BigDecimal)2 ClientSnapshot (name.abuchen.portfolio.snapshot.ClientSnapshot)2 IOException (java.io.IOException)1 LocalDate (java.time.LocalDate)1 TestCurrencyConverter (name.abuchen.portfolio.TestCurrencyConverter)1 Client (name.abuchen.portfolio.model.Client)1 ClientFactory (name.abuchen.portfolio.model.ClientFactory)1 PortfolioTransaction (name.abuchen.portfolio.model.PortfolioTransaction)1 PortfolioTransferEntry (name.abuchen.portfolio.model.PortfolioTransferEntry)1 Security (name.abuchen.portfolio.model.Security)1 ReportingPeriod (name.abuchen.portfolio.snapshot.ReportingPeriod)1 SecurityPerformanceRecord (name.abuchen.portfolio.snapshot.security.SecurityPerformanceRecord)1 SecurityPerformanceSnapshot (name.abuchen.portfolio.snapshot.security.SecurityPerformanceSnapshot)1 Action (org.eclipse.jface.action.Action)1 CoreMatchers.is (org.hamcrest.CoreMatchers.is)1 Assert.assertThat (org.junit.Assert.assertThat)1