Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.AccountTransaction


    public void testDepositPlusInterest()
    {
        Client client = new Client();

        Account account = new Account();
        account.addTransaction(new AccountTransaction(Dates.date(2010, Calendar.JANUARY, 1), null,
                        AccountTransaction.Type.DEPOSIT, 100000));
        account.addTransaction(new AccountTransaction(Dates.date(2011, Calendar.JUNE, 1), null,
                        AccountTransaction.Type.INTEREST, 5000));
        client.addAccount(account);

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


    public void testDepositPlusInterestFirstDay()
    {
        Client client = new Client();

        Account account = new Account();
        account.addTransaction(new AccountTransaction(Dates.date(2010, Calendar.JANUARY, 1), null,
                        AccountTransaction.Type.DEPOSIT, 100000));
        account.addTransaction(new AccountTransaction(Dates.date(2010, Calendar.DECEMBER, 31), null,
                        AccountTransaction.Type.INTEREST, 5000));
        client.addAccount(account);

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

    public void testDepositPlusInterestLastDay()
    {
        Client client = new Client();

        Account account = new Account();
        account.addTransaction(new AccountTransaction(Dates.date(2010, Calendar.JANUARY, 1), null,
                        AccountTransaction.Type.DEPOSIT, 100000));
        account.addTransaction(new AccountTransaction(Dates.date(2011, Calendar.DECEMBER, 31), null,
                        AccountTransaction.Type.INTEREST, 5000));
        client.addAccount(account);

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

        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,
                        AccountTransaction.Type.INTEREST, 5000));
        client.addAccount(account);

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

            cal.setTime(t.getDate());
            dates.add(cal.getTime());

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

                {
                    switch (t.getType())
                    {
                        case DIVIDENDS:
                            long amount = value(t.getAmount(), weight);
                            pseudoAccount.addTransaction(new AccountTransaction(t.getDate(), t.getSecurity(),
                                            AccountTransaction.Type.DIVIDENDS, amount));
                            pseudoAccount.addTransaction(new AccountTransaction(t.getDate(), t.getSecurity(),
                                            AccountTransaction.Type.REMOVAL, amount));
                            break;
                        case BUY:
                        case TRANSFER_IN:
                        case SELL:
View Full Code Here

            switch (t.getType())
            {
                case SELL:
                case TRANSFER_IN:
                case DIVIDENDS:
                    pseudoAccount.addTransaction(new AccountTransaction(t.getDate(), t.getSecurity(),
                                    AccountTransaction.Type.DEPOSIT, amount));
                    break;
                case BUY:
                case TRANSFER_OUT:
                    pseudoAccount.addTransaction(new AccountTransaction(t.getDate(), t.getSecurity(),
                                    AccountTransaction.Type.REMOVAL, amount));
                    break;
                case DEPOSIT:
                case REMOVAL:
                case INTEREST:
                case TAXES:
                case FEES:
                    if (weight != Classification.ONE_HUNDRED_PERCENT)
                        pseudoAccount.addTransaction(new AccountTransaction(t.getDate(), null, t.getType(), amount));
                    else
                        pseudoAccount.addTransaction(t);
                    break;
                default:
                    throw new UnsupportedOperationException();
View Full Code Here

        def.build(client, account, //
                        new String[] { "2013-01-01", "DE0007164600", "", "", "100", "" }, //
                        buildField2Column(def));

        AccountTransaction t = account.getTransactions().get(account.getTransactions().size() - 1);
        assertThat(t.getAmount(), is(100L * Values.Amount.factor()));
        assertThat(t.getDate(), is(Dates.date(2013, Calendar.JANUARY, 1)));
        assertThat(t.getSecurity(), is(client.getSecurities().get(0)));
        assertThat(t.getType(), is(AccountTransaction.Type.DIVIDENDS));
    }
View Full Code Here

    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));

        assertThat(new CrossEntryCheck().execute(client).size(), is(0));
        assertThat(portfolio.getTransactions().get(0).getCrossEntry(), notNullValue());
        assertThat(account.getTransactions().get(0).getCrossEntry(), notNullValue());
View Full Code Here

    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));

        List<Issue> issues = new CrossEntryCheck().execute(client);
        assertThat(issues.size(), is(2));
        List<Object> objects = new ArrayList<Object>(issues);
View Full Code Here

TOP

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

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.