Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.SecurityPrice


        SecurityPosition position = new SecurityPosition(new Security());

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.JANUARY, 1), null, Type.TRANSFER_IN,
                        50 * Values.Share.factor(), 50000, 0, 0));

        position.setPrice(new SecurityPrice(Dates.date(2012, Calendar.DECEMBER, 2), 2000));

        assertEquals(50 * Values.Share.factor(), position.getShares());
        assertEquals(1000L, position.getFIFOPurchasePrice());
        assertEquals(50000L, position.getFIFOPurchaseValue());
        assertEquals(100000L, position.calculateValue());
View Full Code Here


                        50 * Values.Share.factor(), 50000, 0, 0));

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 1), null,
                        Type.TRANSFER_IN, 50 * Values.Share.factor(), 55000, 0, 0));

        position.setPrice(new SecurityPrice(Dates.date(2012, Calendar.DECEMBER, 2), 2000));

        assertEquals(100 * Values.Share.factor(), position.getShares());
        assertEquals(1050L, position.getFIFOPurchasePrice());
        assertEquals(105000L, position.getFIFOPurchaseValue());
        assertEquals(200000L, position.calculateValue());
View Full Code Here

                        Type.TRANSFER_OUT, 50 * Values.Share.factor(), 55000, 0, 0));

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 1), null,
                        Type.TRANSFER_IN, 50 * Values.Share.factor(), 55000, 0, 0));

        position.setPrice(new SecurityPrice(Dates.date(2012, Calendar.DECEMBER, 2), 2000));

        assertEquals(50 * Values.Share.factor(), position.getShares());
        assertEquals(1000L, position.getFIFOPurchasePrice());
        assertEquals(50000L, position.getFIFOPurchaseValue());
        assertEquals(100000L, position.calculateValue());
View Full Code Here

                        Type.TRANSFER_IN, 50 * Values.Share.factor(), 55000, 0, 0));

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 2), null,
                        Type.TRANSFER_IN, 50 * Values.Share.factor(), 55000, 0, 0));

        position.setPrice(new SecurityPrice(Dates.date(2012, Calendar.DECEMBER, 2), 2000));

        assertEquals(100 * Values.Share.factor(), position.getShares());
        assertEquals(1050L, position.getFIFOPurchasePrice());
        assertEquals(105000L, position.getFIFOPurchaseValue());
        assertEquals(200000L, position.calculateValue());
View Full Code Here

                        Type.TRANSFER_IN, 50 * Values.Share.factor(), 55000, 0, 0));

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 2), null,
                        Type.TRANSFER_OUT, 25 * Values.Share.factor(), 55000, 0, 0));

        position.setPrice(new SecurityPrice(Dates.date(2012, Calendar.DECEMBER, 2), 2000));

        assertEquals(25 * Values.Share.factor(), position.getShares());
        assertEquals(1000L, position.getFIFOPurchasePrice());
        assertEquals(25000L, position.getFIFOPurchaseValue());
        assertEquals(50000L, position.calculateValue());
View Full Code Here

                        50 * Values.Share.factor(), 50000, 0, 0));

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 1), null,
                        Type.TRANSFER_OUT, 25 * Values.Share.factor(), 55000, 0, 0));

        position.setPrice(new SecurityPrice(Dates.date(2012, Calendar.DECEMBER, 2), 2000));

        assertEquals(25 * Values.Share.factor(), position.getShares());
        assertEquals(1000L, position.getFIFOPurchasePrice());
        assertEquals(25000L, position.getFIFOPurchaseValue());
        assertEquals(50000L, position.calculateValue());
View Full Code Here

        // Portfolio B : Security B + Security X

        client = new Client();

        securityA = new Security();
        securityA.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 1000));
        client.addSecurity(securityA);

        securityB = new Security();
        securityB.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 1100));
        client.addSecurity(securityB);

        securityX = new Security();
        securityX.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 1200));
        client.addSecurity(securityX);

        Portfolio portfolioA = new Portfolio();
        portfolioA.addTransaction(new PortfolioTransaction(Dates.date(2010, Calendar.JANUARY, 1), securityA,
                        PortfolioTransaction.Type.BUY, 1000000, 10000, 0, 0));
View Full Code Here

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

        Security security = new Security();
        security.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 10000));
        security.addPrice(new SecurityPrice(Dates.date(2011, Calendar.JUNE, 1), 11000));
        client.addSecurity(security);

        Portfolio portfolio = new Portfolio();
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010, Calendar.JANUARY, 1), security,
                        PortfolioTransaction.Type.BUY, 1000000, 100, 0, 0));
View Full Code Here

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

        Security security = new Security();
        security.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 10000));
        security.addPrice(new SecurityPrice(Dates.date(2011, Calendar.JUNE, 1), 11000));
        client.addSecurity(security);

        Portfolio portfolio = new Portfolio();
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010, Calendar.JANUARY, 1), security,
                        PortfolioTransaction.Type.BUY, 1000000, 100, 0, 0));
View Full Code Here

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

        Security security = new Security();
        security.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 10000));
        security.addPrice(new SecurityPrice(Dates.date(2011, Calendar.JUNE, 1), 11000));
        client.addSecurity(security);

        Portfolio portfolio = new Portfolio();
        portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010, Calendar.JANUARY, 1), security,
                        PortfolioTransaction.Type.BUY, 1000000, 100, 0, 0));
View Full Code Here

TOP

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

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.