Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.AccountTransaction


    }

    @Test
    public void testMissingAccountTransferOutIssue()
    {
        account.addTransaction(new AccountTransaction(Dates.today(), security, //
                        AccountTransaction.Type.TRANSFER_IN, 1));

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

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


    }

    @Test
    public void testMissingAccountTransferInIssue()
    {
        account.addTransaction(new AccountTransaction(Dates.today(), security, //
                        AccountTransaction.Type.TRANSFER_OUT, 1));

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

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

        def.build(client, account, //
                        new String[] { "2013-01-01", "", "SAP.DE", "", "200", "DIVIDENDS" }, //
                        buildField2Column(def));

        AccountTransaction t = account.getTransactions().get(account.getTransactions().size() - 1);
        assertThat(t.getAmount(), is(200L * 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 testThatNotTheSameAccountIsMatched()
    {
        Account second = new Account();
        client.addAccount(second);

        account.addTransaction(new AccountTransaction(Dates.today(), security, //
                        AccountTransaction.Type.TRANSFER_IN, 2));

        AccountTransaction umatched = new AccountTransaction(Dates.today(), security, //
                        AccountTransaction.Type.TRANSFER_OUT, 2);
        account.addTransaction(umatched);

        second.addTransaction(new AccountTransaction(Dates.today(), security, //
                        AccountTransaction.Type.TRANSFER_OUT, 2));

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

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

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

        account.addTransaction(new AccountTransaction(Dates.today(), null, //
                        AccountTransaction.Type.BUY, 1));

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

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

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

        AccountTransaction t = account.getTransactions().get(account.getTransactions().size() - 1);
        assertThat(t.getAmount(), is(300L * 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.FEES));
    }
View Full Code Here

        def.build(client, account, //
                        new String[] { "2013-01-01", "DE000BASF111", "BAS.DE", "BASF11", "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(), isIn(client.getSecurities()));
        assertThat(t.getSecurity().getIsin(), is("DE000BASF111"));
        assertThat(t.getSecurity().getTickerSymbol(), is("BAS.DE"));
        assertThat(t.getSecurity().getWkn(), is("BASF11"));
    }
View Full Code Here

        return transaction(Type.REMOVAL, date, amount);
    }

    public AccountBuilder dividend(String date, long amount, Security security)
    {
        AccountTransaction t = new AccountTransaction(new DateMidnight(date).toDate(), security, Type.DIVIDENDS, amount);
        account.addTransaction(t);
        return this;
    }
View Full Code Here

        return transaction(type, new DateMidnight(date), amount);
    }

    private AccountBuilder transaction(Type type, DateMidnight date, long amount)
    {
        AccountTransaction t = new AccountTransaction(date.toDate(), null, type, amount);
        account.addTransaction(t);
        return this;
    }
View Full Code Here

                {
                    switch (t.getType())
                    {
                        case DIVIDENDS:
                            pseudoAccount.addTransaction(t);
                            pseudoAccount.addTransaction(new AccountTransaction(t.getDate(), t.getSecurity(),
                                            AccountTransaction.Type.REMOVAL, t.getAmount()));
                            break;
                        case BUY:
                        case TRANSFER_IN:
                        case SELL:
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.