Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.PortfolioTransaction


    @Test
    public void testThatTransferInCountsIfTransferOutIsMissingPlusBuyTransaction()
    {
        SecurityPosition position = new SecurityPosition(new Security());

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.JANUARY, 1), null, Type.BUY,
                        50 * Values.Share.factor(), 50000, 0, 0));

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 1), null,
                        Type.TRANSFER_IN, 50 * Values.Share.factor(), 55000, 0, 0));

        position.setPrice(new SecurityPrice(Dates.date(2012, Calendar.DECEMBER, 2), 2000));

        assertEquals(100 * Values.Share.factor(), position.getShares());
View Full Code Here


        Security security = new Security();
        client.addSecurity(security);

        Portfolio portfolio = new Portfolio();
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010, Calendar.JANUARY, 1), security,
                        PortfolioTransaction.Type.BUY, 10, 100, 0, 0));
        client.addPortfolio(portfolio);

        Account account = new Account();
        account.addTransaction(new AccountTransaction(Dates.date(2011, Calendar.JANUARY, 31), security,
View Full Code Here

        security.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 10000));
        security.addPrice(new SecurityPrice(Dates.date(2011, Calendar.JUNE, 1), 11000));
        client.addSecurity(security);

        Portfolio portfolio = new Portfolio();
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010, Calendar.JANUARY, 1), security,
                        PortfolioTransaction.Type.BUY, 1000000, 100, 0, 0));
        client.addPortfolio(portfolio);

        ClientPerformanceSnapshot snapshot = new ClientPerformanceSnapshot(client, startDate, endDate);
View Full Code Here

        security.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 10000));
        security.addPrice(new SecurityPrice(Dates.date(2011, Calendar.JUNE, 1), 11000));
        client.addSecurity(security);

        Portfolio portfolio = new Portfolio();
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010, Calendar.JANUARY, 1), security,
                        PortfolioTransaction.Type.BUY, 1000000, 100, 0, 0));
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2011, Calendar.JANUARY, 15), security,
                        PortfolioTransaction.Type.BUY, 100000, 9900, 0, 0));
        client.addPortfolio(portfolio);

        ClientPerformanceSnapshot snapshot = new ClientPerformanceSnapshot(client, startDate, endDate);
View Full Code Here

        security.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 10000));
        security.addPrice(new SecurityPrice(Dates.date(2011, Calendar.JUNE, 1), 11000));
        client.addSecurity(security);

        Portfolio portfolio = new Portfolio();
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010, Calendar.JANUARY, 1), security,
                        PortfolioTransaction.Type.BUY, 1000000, 100, 0, 0));
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2011, Calendar.JANUARY, 15), security,
                        PortfolioTransaction.Type.SELL, 100000, 9900, 0, 0));
        client.addPortfolio(portfolio);

        ClientPerformanceSnapshot snapshot = new ClientPerformanceSnapshot(client, startDate, endDate);
View Full Code Here

        security.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 10000));
        security.addPrice(new SecurityPrice(Dates.date(2011, Calendar.JUNE, 1), 11000));
        client.addSecurity(security);

        Portfolio portfolio = new Portfolio();
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010, Calendar.JANUARY, 1), security,
                        PortfolioTransaction.Type.BUY, 1000000, 100, 0, 0));
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2011, Calendar.JANUARY, 15), security,
                        PortfolioTransaction.Type.SELL, 100000, 9900, 1, 0));
        client.addPortfolio(portfolio);

        ClientPerformanceSnapshot snapshot = new ClientPerformanceSnapshot(client, startDate, endDate);
View Full Code Here

                    amount = -amount;
                values.add(amount / Values.Amount.divider());
            }
            else if (t instanceof PortfolioTransaction)
            {
                PortfolioTransaction pt = (PortfolioTransaction) t;

                long amount = pt.getAmount();
                if (pt.getType() == PortfolioTransaction.Type.DELIVERY_INBOUND
                                || pt.getType() == PortfolioTransaction.Type.TRANSFER_IN)
                    amount = -amount;
                values.add(amount / Values.Amount.divider());
            }
            else
            {
View Full Code Here

                    switch (t.getType())
                    {
                        case BUY:
                        case TRANSFER_IN:
                        {
                            pseudoPortfolio.addTransaction(new PortfolioTransaction(t.getDate(), t.getSecurity(),
                                            PortfolioTransaction.Type.DELIVERY_INBOUND, shares, amount, fees, taxes));
                            break;
                        }
                        case SELL:
                        case TRANSFER_OUT:
                            pseudoPortfolio.addTransaction(new PortfolioTransaction(t.getDate(), t.getSecurity(),
                                            PortfolioTransaction.Type.DELIVERY_OUTBOUND, shares, amount, fees, taxes));
                            break;
                        case DELIVERY_INBOUND:
                        case DELIVERY_OUTBOUND:
                            pseudoPortfolio.addTransaction(new PortfolioTransaction(t.getDate(), t.getSecurity(), t
                                            .getType(), shares, amount, fees, taxes));
                            break;
                        default:
                            throw new UnsupportedOperationException();
                    }
View Full Code Here

    }

    @Test
    public void testMissingSellInAccountIssue()
    {
        portfolio.addTransaction(new PortfolioTransaction(Dates.today(), security, //
                        PortfolioTransaction.Type.BUY, 1, 1, 1, 0));

        List<Issue> issues = new CrossEntryCheck().execute(client);

        assertThat(issues.size(), is(1));
View Full Code Here

    }

    @Test
    public void testMissingBuyInAccountIssue()
    {
        portfolio.addTransaction(new PortfolioTransaction(Dates.today(), security, //
                        PortfolioTransaction.Type.SELL, 1, 1, 1, 0));

        List<Issue> issues = new CrossEntryCheck().execute(client);

        assertThat(issues.size(), is(1));
View Full Code Here

TOP

Related Classes of name.abuchen.portfolio.model.PortfolioTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.