Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.Account


    @Test
    public void testThatSecurityIsCreatedIfNotFound_whenImportingAccountTransactions() throws ParseException
    {
        Client client = buildClient();
        Account account = client.getAccounts().get(0);

        AccountTransactionDef def = new AccountTransactionDef();

        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"));
View Full Code Here


    @Before
    public void setupClient()
    {
        client = new Client();
        account = new Account();
        client.addAccount(account);
        portfolio = new Portfolio();
        client.addPortfolio(portfolio);
        security = new Security();
        client.addSecurity(security);
View Full Code Here

    }

    @Test
    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));
        assertThat(issues.get(0), is(instanceOf(MissingAccountTransferIssue.class)));

        assertThat(account.getTransactions(), hasItem(umatched));
        assertThat(second.getTransactions().get(0).getCrossEntry(), notNullValue());
        assertThat(second.getTransactions().get(0).getType(), is(AccountTransaction.Type.TRANSFER_OUT));

        applyFixes(client, issues);
    }
View Full Code Here

    private Client buildClient()
    {
        Client client = new Client();

        Account account = new Account();
        account.setName("test");
        client.addAccount(account);

        Portfolio portfolio = new Portfolio();
        portfolio.setName("test");
        portfolio.setReferenceAccount(account);
View Full Code Here

{
    private Account account;

    public AccountBuilder()
    {
        this.account = new Account();
        this.account.setName(UUID.randomUUID().toString());
    }
View Full Code Here

    private PortfolioBuilder buysell(Type type, Security security, String date, long shares, int amount)
    {
        if (portfolio.getReferenceAccount() == null)
        {
            account = new Account(UUID.randomUUID().toString());
            portfolio.setReferenceAccount(account);
        }

        BuySellEntry entry = new BuySellEntry(portfolio, portfolio.getReferenceAccount());
        entry.setType(type);
View Full Code Here

    /* package */static PerformanceIndex calculate(Client client, Portfolio portfolio, ReportingPeriod reportInterval,
                    List<Exception> warnings)
    {
        Client pseudoClient = new Client();

        Account pseudoAccount = new Account();
        pseudoAccount.setName(""); //$NON-NLS-1$
        pseudoClient.addAccount(pseudoAccount);

        Portfolio pseudoPortfolio = new Portfolio();
        pseudoPortfolio.setReferenceAccount(pseudoAccount);
        pseudoClient.addPortfolio(pseudoPortfolio);
View Full Code Here

            public void widgetSelected(SelectionEvent e)
            {
                String acnName = accountName.getText();
                if (acnName.length() > 0)
                {
                    Account currentAccount = new Account();
                    currentAccount.setName(acnName);
                    client.addAccount(currentAccount);
                    tViewer.refresh();

                    accountName.setText(""); //$NON-NLS-1$
                    accountName.setFocus();
View Full Code Here

            {
                String portName = portfolioName.getText();
                String acnName = accountName.getText();
                if (portName.length() > 0 && acnName.length() > 0)
                {
                    Account account = new Account();
                    account.setName(acnName);
                    Portfolio portfolio = new Portfolio();
                    portfolio.setName(portName);
                    portfolio.setReferenceAccount(account);
                    client.addAccount(account);
                    client.addPortfolio(portfolio);
View Full Code Here

                {
                    portfolio.setReferenceAccount(getClient().getAccounts().get(0));
                }
                else
                {
                    Account account = new Account();
                    account.setName(Messages.LabelDefaultReferenceAccountName);
                    getClient().addAccount(account);
                    portfolio.setReferenceAccount(account);
                }

                getClient().addPortfolio(portfolio);
View Full Code Here

TOP

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

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.