Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.PortfolioTransaction


    }

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

        account.addTransaction(new AccountTransaction(Dates.today(), security, //
                        AccountTransaction.Type.SELL, 1));
View Full Code Here


    }

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

        account.addTransaction(new AccountTransaction(Dates.today(), security, //
                        AccountTransaction.Type.SELL, 2));
View Full Code Here

    }

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

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

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

    }

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

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

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

    public void testThatNotTheSamePortfolioIsMatched()
    {
        Portfolio second = new Portfolio();
        client.addPortfolio(second);

        portfolio.addTransaction(new PortfolioTransaction(Dates.today(), security, //
                        PortfolioTransaction.Type.TRANSFER_IN, 1, 3, 1, 0));

        PortfolioTransaction umatched = new PortfolioTransaction(Dates.today(), security, //
                        PortfolioTransaction.Type.TRANSFER_OUT, 1, 3, 1, 0);
        portfolio.addTransaction(umatched);

        second.addTransaction(new PortfolioTransaction(Dates.today(), security, //
                        PortfolioTransaction.Type.TRANSFER_OUT, 1, 3, 1, 0));

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

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

        def.build(client, portfolio, //
                        new String[] { "2013-01-01", security.getIsin(), "", "", "1000,00", "10,00", "11,00", "1,234",
                                        "BUY" }, //
                        buildField2Column(def));

        PortfolioTransaction t = portfolio.getTransactions().get(portfolio.getTransactions().size() - 1);
        assertThat(t.getSecurity(), is(security));
        assertThat(t.getShares(), is((long) (1.234 * Values.Share.factor())));
        assertThat(t.getFees(), is(10L * Values.Amount.factor()));
        assertThat(t.getTaxes(), is(11L * Values.Amount.factor()));
        assertThat(t.getAmount(), is(1000L * Values.Amount.factor()));
        assertThat(t.getType(), is(PortfolioTransaction.Type.BUY));
    }
View Full Code Here

            else if (t.getType() == Type.TRANSFER_OUT)
            {
                Iterator<PortfolioTransaction> iter = inbound.iterator();
                while (iter.hasNext())
                {
                    PortfolioTransaction t_inbound = iter.next();
                    if (t_inbound.getDate().equals(t.getDate()) && t_inbound.getShares() == t.getShares())
                    {
                        iter.remove();
                        continue TransactionLoop;
                    }
                }
View Full Code Here

        answer.price = position.price;
        answer.shares = Math.round(position.shares * weight / (double) Classification.ONE_HUNDRED_PERCENT);

        for (PortfolioTransaction t : position.transactions)
        {
            PortfolioTransaction t2 = new PortfolioTransaction();
            t2.setDate(t.getDate());
            t2.setSecurity(t.getSecurity());
            t2.setType(t.getType());

            t2.setAmount(Math.round(t.getAmount() * weight / (double) Classification.ONE_HUNDRED_PERCENT));
            t2.setFees(Math.round(t.getFees() * weight / (double) Classification.ONE_HUNDRED_PERCENT));
            t2.setTaxes(Math.round(t.getTaxes() * weight / (double) Classification.ONE_HUNDRED_PERCENT));
            t2.setShares(Math.round(t.getShares() * weight / (double) Classification.ONE_HUNDRED_PERCENT));

            answer.transactions.add(t2);
        }

        return answer;
View Full Code Here

        return inbound_delivery(security, new DateMidnight(date), shares, amount);
    }

    public PortfolioBuilder inbound_delivery(Security security, DateMidnight date, long shares, long amount)
    {
        portfolio.addTransaction(new PortfolioTransaction(date.toDate(), security, Type.DELIVERY_INBOUND, shares,
                        amount, 0, 0));
        return this;
    }
View Full Code Here

            switch (t.getType())
            {
                case BUY:
                case TRANSFER_IN:
                {
                    pseudoPortfolio.addTransaction(new PortfolioTransaction(t.getDate(), t.getSecurity(),
                                    PortfolioTransaction.Type.DELIVERY_INBOUND, t.getShares(), t.getAmount(), t
                                                    .getFees(), t.getTaxes()));
                    break;
                }
                case SELL:
                case TRANSFER_OUT:
                    pseudoPortfolio.addTransaction(new PortfolioTransaction(t.getDate(), t.getSecurity(),
                                    PortfolioTransaction.Type.DELIVERY_OUTBOUND, t.getShares(), t.getAmount(), t
                                                    .getFees(), t.getTaxes()));
                    break;
                case DELIVERY_INBOUND:
                case DELIVERY_OUTBOUND:
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.