Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.Client


{
    private static final double PRECISION = 0.000001d;

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

        new AccountBuilder() //
                        .deposit_("2011-12-31", 10000 * Values.Amount.factor()) //
                        .interest("2012-01-01", 230 * Values.Amount.factor()) //
                        .deposit_("2012-01-02", 200 * Values.Amount.factor()) //
View Full Code Here


    }

    @Test
    public void testExcelSample()
    {
        Client client = createClient();

        ReportingPeriod.FromXtoY period = new ReportingPeriod.FromXtoY(Dates.date(2011, Calendar.DECEMBER, 31), //
                        Dates.date(2012, Calendar.JANUARY, 8));
        ClientIndex index = PerformanceIndex.forClient(client, period, new ArrayList<Exception>());
View Full Code Here

        assertThat(accumulated[8], IsCloseTo.closeTo(-0.05d, PRECISION));
    }

    private Client createClient(double[] delta, long[] transferals)
    {
        Client client = new Client();

        AccountBuilder account = new AccountBuilder();

        DateMidnight time = new DateMidnight("2012-01-01");
View Full Code Here

    {
        double[] delta = { 0d, 0.023d, 0.043d, 0.02d, 0.05d, 0.08d, 0.1d, 0.04d, -0.05d };
        long[] transferals = { 1000000, 0, 20000, -40000, 0, 0, 540000, -369704, 0 };
        long[] transferals2 = { 1000000, 0, 0, 0, 0, 0, 0, 0, 0 };

        Client client = createClient(delta, transferals);

        ReportingPeriod.FromXtoY period = new ReportingPeriod.FromXtoY(Dates.date(2012, Calendar.JANUARY, 1), //
                        Dates.date(2012, Calendar.JANUARY, 9));
        ClientIndex index = PerformanceIndex.forClient(client, period, new ArrayList<Exception>());

        double[] accumulated = index.getAccumulatedPercentage();
        for (int ii = 0; ii < accumulated.length; ii++)
            assertThat(accumulated[ii], IsCloseTo.closeTo(delta[ii], PRECISION));

        Client anotherClient = createClient(delta, transferals2);
        index = PerformanceIndex.forClient(anotherClient, period, new ArrayList<Exception>());

        accumulated = index.getAccumulatedPercentage();
        for (int ii = 0; ii < accumulated.length; ii++)
            assertThat(accumulated[ii], IsCloseTo.closeTo(delta[ii], PRECISION));
View Full Code Here

    }

    @Test
    public void testThatNoValuationResultsInZeroPerformance()
    {
        Client client = new Client();

        ReportingPeriod.FromXtoY period = new ReportingPeriod.FromXtoY(Dates.date(2012, Calendar.JANUARY, 1), //
                        Dates.date(2012, Calendar.JANUARY, 9));
        ClientIndex index = PerformanceIndex.forClient(client, period, new ArrayList<Exception>());
View Full Code Here

    }

    @Test
    public void testThatInterstWithoutInvestmentDoesNotCorruptResultAndIsReported()
    {
        Client client = new Client();
        new AccountBuilder() //
                        .interest("2012-01-02", 100) //
                        .addTo(client);

        ReportingPeriod.FromXtoY period = new ReportingPeriod.FromXtoY(Dates.date(2012, Calendar.JANUARY, 1), //
View Full Code Here

    }

    @Test
    public void testFirstDataPointWhenInsideReportingInterval()
    {
        Client client = createClient();

        ReportingPeriod.FromXtoY period = new ReportingPeriod.FromXtoY(Dates.date(2011, Calendar.DECEMBER, 20), //
                        Dates.date(2012, Calendar.JANUARY, 8));
        ClientIndex index = PerformanceIndex.forClient(client, period, new ArrayList<Exception>());
View Full Code Here

    {
        DateMidnight startDate = new DateMidnight(2012, 1, 1);
        DateMidnight endDate = new DateMidnight(2012, 4, 29); // a weekend
        long startPrice = 100 * Values.Amount.factor();

        Client client = new Client();

        Security security = new SecurityBuilder() //
                        .generatePrices(startPrice, startDate, endDate) //
                        .addTo(client);

View Full Code Here

    }

    @Test
    public void testExcelSampleAggregatedWeekly()
    {
        Client client = createClient();

        ReportingPeriod.FromXtoY reportInterval = new ReportingPeriod.FromXtoY(Dates.date(2011, Calendar.DECEMBER, 31), //
                        Dates.date(2012, Calendar.JANUARY, 8));
        PerformanceIndex index = PerformanceIndex.forClient(client, reportInterval, new ArrayList<Exception>());
View Full Code Here

    }

    @Test
    public void testThatDepositsOnTheLastDayArePerformanceNeutral()
    {
        Client client = new Client();

        new AccountBuilder() //
                        .deposit_("2012-01-01", 10000) //
                        .interest("2012-01-02", 1000) //
                        .deposit_("2012-01-10", 10000) //
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.