Package org.joda.time

Examples of org.joda.time.DateMidnight.toDate()


        // calculate performance indices

        List<Exception> warnings = new ArrayList<Exception>();

        ReportingPeriod reportInterval = new ReportingPeriod.FromXtoY(startDate.toDate(), endDate.toDate());
        ClientIndex clientIndex = PerformanceIndex.forClient(client, reportInterval, warnings);
        PerformanceIndex securityIndex = PerformanceIndex.forSecurity(clientIndex, security, warnings);

        // asserts
View Full Code Here


        assertTrue(warnings.isEmpty());

        Date[] dates = securityIndex.getDates();
        assertThat(dates[0], is(startDate.toDate()));
        assertThat(dates[dates.length - 1], is(endDate.toDate()));

        long lastPrice = security.getSecurityPrice(endDate.toDate()).getValue();
        double performance = (double) (lastPrice - startPrice) / (double) startPrice;

        double[] accumulated = securityIndex.getAccumulatedPercentage();
View Full Code Here

        Date[] dates = securityIndex.getDates();
        assertThat(dates[0], is(startDate.toDate()));
        assertThat(dates[dates.length - 1], is(endDate.toDate()));

        long lastPrice = security.getSecurityPrice(endDate.toDate()).getValue();
        double performance = (double) (lastPrice - startPrice) / (double) startPrice;

        double[] accumulated = securityIndex.getAccumulatedPercentage();
        assertThat(accumulated[0], is(0d));
        assertThat(accumulated[accumulated.length - 1], IsCloseTo.closeTo(performance, 0.000001d));
View Full Code Here

        // calculate performance indices

        List<Exception> warnings = new ArrayList<Exception>();

        ReportingPeriod reportInterval = new ReportingPeriod.FromXtoY(startDate.toDate(), endDate.toDate());
        ClientIndex clientIndex = PerformanceIndex.forClient(client, reportInterval, warnings);
        PerformanceIndex securityIndex = PerformanceIndex.forSecurity(clientIndex, security, warnings);

        // asserts
View Full Code Here

        Date[] clientDates = clientIndex.getDates();
        Date[] securityDates = securityIndex.getDates();

        assertThat(securityDates[0], is(middleDate.toDate()));
        assertThat(securityDates[securityDates.length - 1], is(endDate.toDate()));
        assertThat(new DateMidnight(clientDates[clientDates.length - 1]), is(new DateMidnight(
                        securityDates[securityDates.length - 1])));

        double[] clientAccumulated = clientIndex.getAccumulatedPercentage();
        double[] securityAccumulated = securityIndex.getAccumulatedPercentage();
View Full Code Here

        int index = Days.daysBetween(startDate, middleDate).getDays();
        assertThat(new DateMidnight(clientDates[index]), is(middleDate));
        assertThat(securityAccumulated[0], IsCloseTo.closeTo(clientAccumulated[index], 0.000001d));

        long middlePrice = security.getSecurityPrice(middleDate.toDate()).getValue();
        long lastPrice = security.getSecurityPrice(endDate.toDate()).getValue();

        // 10% is interest of the deposit
        double performance = (double) (lastPrice - middlePrice) / (double) middlePrice + 0.1d;
        assertThat(securityAccumulated[securityAccumulated.length - 1], IsCloseTo.closeTo(performance, 0.000001d));
    }
View Full Code Here

        // calculate performance indices

        List<Exception> warnings = new ArrayList<Exception>();

        ReportingPeriod reportInterval = new ReportingPeriod.FromXtoY(startDate.toDate(), endDate.toDate());
        ClientIndex clientIndex = PerformanceIndex.forClient(client, reportInterval, warnings);
        PerformanceIndex securityIndex = PerformanceIndex.forSecurity(clientIndex, security, warnings);

        // asserts
View Full Code Here

        // calculate performance indices

        List<Exception> warnings = new ArrayList<Exception>();

        ReportingPeriod reportInterval = new ReportingPeriod.FromXtoY(startDate.toDate(), endDate.toDate());
        ClientIndex clientIndex = PerformanceIndex.forClient(client, reportInterval, warnings);
        PerformanceIndex securityIndex = PerformanceIndex.forSecurity(clientIndex, security, warnings);

        // asserts
View Full Code Here

            d = ((d + 1) * (delta[ii] + 1)) - 1;
            t += transferals[ii];

            if (current.equals(kill) || ii == dates.length - 1)
            {
                cDates.add(current.toDate());
                cAccumulated.add(accumulated[ii]);
                cDelta.add(d);
                cTransferals.add(t);
                cTotals.add(totals[ii]);

View Full Code Here

            if (interval.contains(date))
            {
                if (baseline == -1)
                    baseline = cpi.getIndex();

                dates.add(date.toDate());
                accumulated.add(((double) cpi.getIndex() / (double) baseline) - 1);
            }
        }

        this.dates = dates.toArray(new Date[0]);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.