Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.Client


    }

    @Test
    public void testThatSecurityIsFoundByTicker_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", "", "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


    }

    @Test
    public void testThatSecurityIsFoundByWKN_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", "", "", "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

    }

    @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"));
        assertThat(t.getSecurity().getWkn(), is("BASF11"));
    }
View Full Code Here

    }

    @Test
    public void testThatPortfolioTransactionIsImported() throws ParseException
    {
        Client client = buildClient();
        Portfolio portfolio = client.getPortfolios().get(0);
        Security security = client.getSecurities().get(0);

        PortfolioTransactionDef def = new PortfolioTransactionDef();

        def.build(client, portfolio, //
                        new String[] { "2013-01-01", security.getIsin(), "", "", "1000,00", "10,00", "11,00", "1,234",
View Full Code Here

    }

    @Test
    public void testThatSecurityPriceIsImported() throws ParseException
    {
        Client client = buildClient();
        Security security = client.getSecurities().get(0);

        SecurityPriceDef def = new SecurityPriceDef();

        def.build(client, security, //
                        new String[] { "2013-01-01", "123,45" }, //
View Full Code Here

    }

    @Test
    public void testThatSecurityIsImported() throws ParseException
    {
        Client client = buildClient();

        SecurityDef def = new SecurityDef();

        def.build(client, Messages.CSVDefSecurityMasterData, //
                        new String[] { "DE0008404005", "ALV.DE", "840400", "Allianz", "" }, //
                        buildField2Column(def));

        Security s = client.getSecurities().get(client.getSecurities().size() - 1);
        assertThat(s.getName(), is("Allianz"));
        assertThat(s.getIsin(), is("DE0008404005"));
        assertThat(s.getTickerSymbol(), is("ALV.DE"));
        assertThat(s.getWkn(), is("840400"));
    }
View Full Code Here

    @Test
    public void testThatSecurityIsNotImportedIfItAlreadyExists()
    {
        try
        {
            Client client = buildClient();

            SecurityDef def = new SecurityDef();

            def.build(client, Messages.CSVDefSecurityMasterData, //
                            new String[] { "DE0007164600", "", "", "SAP AG", "" }, //
View Full Code Here

    @Test
    public void testThatExceptionIsThrownIfOneOfRequiredFieldsIsMissing_whenImportingSecurities()
    {
        try
        {
            Client client = buildClient();

            SecurityDef def = new SecurityDef();

            def.build(client, Messages.CSVDefSecurityMasterData, //
                            new String[] { "something" }, //
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);
        client.addPortfolio(portfolio);

        Security security = new Security();
        security.setName("SAP AG");
        security.setIsin("DE0007164600");
        security.setWkn("716460");
        security.setTickerSymbol("SAP.DE");
        client.addSecurity(security);

        return client;
    }
View Full Code Here

    private List<Item> items = new ArrayList<Item>();

    public GroupEarningsByAccount(ClientPerformanceSnapshot snapshot)
    {
        Client client = snapshot.getEndClientSnapshot().getClient();
        long startDate = snapshot.getStartClientSnapshot().getTime().getTime();
        long endDate = snapshot.getEndClientSnapshot().getTime().getTime();

        for (Account account : client.getAccounts())
        {
            Item item = new Item(account);

            for (AccountTransaction t : account.getTransactions())
            {
View Full Code Here

TOP

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

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.