Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.Security


{

    @Test
    public void testFIFOPurchasePrice()
    {
        SecurityPosition position = new SecurityPosition(new Security());

        position.addTransaction(new PortfolioTransaction(Dates.today(), null, Type.BUY, 100 * Values.Share.factor(),
                        100000, 0, 0));
        position.addTransaction(new PortfolioTransaction(Dates.today(), null, Type.SELL, 50 * Values.Share.factor(),
                        50000, 0, 0));
View Full Code Here


    }

    @Test
    public void testPurchasePriceWithMultipleBuyTransactions()
    {
        SecurityPosition position = new SecurityPosition(new Security());

        position.addTransaction(new PortfolioTransaction(Dates.today(), null, Type.BUY, 25 * Values.Share.factor(),
                        25000, 0, 0));
        position.addTransaction(new PortfolioTransaction(Dates.today(), null, Type.BUY, 75 * Values.Share.factor(),
                        150000, 0, 0));
View Full Code Here

    }

    @Test
    public void testPurchasePriceWithMultipleBuyTransactionsMiddlePrice()
    {
        SecurityPosition position = new SecurityPosition(new Security());

        position.addTransaction(new PortfolioTransaction(Dates.today(), null, Type.BUY, 75 * Values.Share.factor(),
                        75000, 0, 0));
        position.addTransaction(new PortfolioTransaction(Dates.today(), null, Type.BUY, 25 * Values.Share.factor(),
                        50000, 0, 0));
View Full Code Here

    }

    @Test
    public void testPurchasePriceNaNIfOnlySellTransactions()
    {
        SecurityPosition position = new SecurityPosition(new Security());

        position.addTransaction(new PortfolioTransaction(Dates.today(), null, Type.SELL, 50 * Values.Share.factor(),
                        50000, 0, 0));

        assertEquals(-50 * Values.Share.factor(), position.getShares());
View Full Code Here

    }

    @Test
    public void testThatTransferInCountsIfTransferOutIsMissing()
    {
        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));
View Full Code Here

    }

    @Test
    public void testThatTransferInCountsIfTransferOutIsMissingPlusBuyTransaction()
    {
        SecurityPosition position = new SecurityPosition(new Security());

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

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 1), null,
View Full Code Here

    }

    @Test
    public void testThatTransferInDoesNotCountIfMatchingTransferOutIsIncluded()
    {
        SecurityPosition position = new SecurityPosition(new Security());

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

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 1), null,
View Full Code Here

    }

    @Test
    public void testThatOnlyMatchingTransfersAreRemoved_InRemains()
    {
        SecurityPosition position = new SecurityPosition(new Security());

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

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 1), null,
View Full Code Here

    }

    @Test
    public void testThatOnlyMatchingTransfersAreRemoved_OutRemains()
    {
        SecurityPosition position = new SecurityPosition(new Security());

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

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 1), null,
View Full Code Here

    }

    @Test
    public void testPurchasePriceIfSharesArePartiallyTransferredOut()
    {
        SecurityPosition position = new SecurityPosition(new Security());

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

        position.addTransaction(new PortfolioTransaction(Dates.date(2012, Calendar.FEBRUARY, 1), null,
View Full Code Here

TOP

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

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.