void removeDays(int i) { DateTime first = beginningOfSeries(); DateTime midnight = first.toDateMidnight().toDateTime(); DateTime cutoff = midnight.plusDays(i); prices = new TreeMap<DateTime, BigDecimal>(prices.tailMap(cutoff)); } }
public DateTime closeOnDay(DateTime date) { DateTime midnight = date.toDateMidnight().toDateTime(); DateTime nextDay = midnight.plusDays(1); return prices.floorEntry(nextDay).getKey(); }
public BigDecimal openOnDay(DateTime date) { DateTime midnight = date.toDateMidnight().toDateTime(); NavigableMap<DateTime, BigDecimal> previousPrices = prices.subMap(midnight, true, date, true); return previousPrices.firstEntry().getValue(); }
@Override public boolean buy(DateTime time, Session session) { if (session.inMarket(time)) { return false; } BigDecimal open = asset.getTimeSeries().openOnDay(time); BigDecimal current = asset.priceAt(time); BigDecimal increase = current.subtract(open); final DateTime midnight = time.toDateMidnight().toDateTime(); final DateTime nextDay = midnight.plusDays(1); boolean tradedToday = (Collections2.filter(session.getTrades(), new Predicate<Trade>() { @Override public boolean apply(Trade trade) { return trade.getOpen().compareTo(midnight) > 0 && trade.getClose().compareTo(nextDay) < 0; } })).size() > 0; return !tradedToday && increase.compareTo(buyTrigger) >= 0; }
@Override public void setEnd(DateMidnight end) { this.endDateMidnight = end; this.end = end.toDateTime(); }
@Override public void setStart(DateMidnight start) { this.startDateMidnight = start; this.start = start.toDateTime(); }
@Override public DateTime getBegin(DateTime date) { return date.toDateMidnight().toDateTime(); }
@Override public DateTime getBegin(DateTime date) { return date.toDateMidnight().toDateTime(); }
public DateTime closeOnDay(DateTime date) { DateTime midnight = date.toDateMidnight().toDateTime(); DateTime nextDay = midnight.plusDays(1); return prices.floorEntry(nextDay).getKey(); }
@ResourceMapping("intervalCount") public ModelAndView getIntervalCount( @RequestParam("interval") AggregationInterval interval, @RequestParam("start") DateMidnight start, @RequestParam("end") DateMidnight end) throws TypeMismatchException { final int intervalsBetween = this.intervalHelper.intervalsBetween( interval, start.toDateTime(), end.plusDays(1).toDateTime().minusSeconds(1)); return new ModelAndView("json", "intervalsBetween", intervalsBetween); } }
public BigDecimal openOnDay(DateTime date) { DateTime midnight = date.toDateMidnight().toDateTime(); NavigableMap<DateTime, BigDecimal> previousPrices = prices.subMap(midnight, true, date, true); return previousPrices.firstEntry().getValue(); }
@Deprecated public static Interval intervalWithEnd(Interval originalInterval, YearMonthDay day) { long millis = day.toDateMidnight().toDateTime().withTime(23, 59, 59, 999).getMillis(); return new Interval(originalInterval.getStartMillis(), millis); }
/** * @see org.projectforge.web.calendar.CalendarPanel#onCallGetEventsHook() */ @Override protected void onCallGetEventsHook(final View view, final CalendarResponse response) { final TeamCalCalendarForm tempForm = (TeamCalCalendarForm) ((TeamCalCalendarPage) getPage()).getForm(); if (tempForm != null && CollectionUtils.isNotEmpty(tempForm.getSelectedCalendars()) == true) { eventProvider.getEvents(view.getVisibleStart().toDateTime(), view.getVisibleEnd().toDateTime()); } }
@Deprecated public static Interval getInterval(YearMonthDay startDate, YearMonthDay endDate) { long start = startDate == null ? Long.MIN_VALUE : startDate.toDateMidnight().getMillis(); long end = endDate == null ? Long.MAX_VALUE : endDate.toDateMidnight().toDateTime().withTime(23, 59, 59, 999).getMillis(); return new Interval(start, end); }
public static Interval getInterval(LocalDate startDate, LocalDate endDate) { long start = startDate == null ? Long.MIN_VALUE : startDate.toDateMidnight().getMillis(); long end = endDate == null ? Long.MAX_VALUE : endDate.toDateMidnight().toDateTime().withTime(23, 59, 59, 999).getMillis(); return new Interval(start, end); }
public DateTime getEndDateBeforeMidnight() { if (getEndDate() == null) { return null; } return getEndDate().plusDays(1).toDateMidnight().toDateTime().minusSeconds(1); } }
@Future public DateTime getEndTime() { return endDate.toDateTime().withHourOfDay(endHourMinute.getHourOfDay()).withMinuteOfHour(endHourMinute.getMinuteOfHour()); }
@Future @FutureWithYearLimit() public DateTime getStartTime() { return startDate.toDateTime().withHourOfDay(startHourMinute.getHourOfDay()).withMinuteOfHour(startHourMinute.getMinuteOfHour()); }
/** * Get start of application for leave as date with time. * * @return start date with time or {@code null} if start date or start time is missing */ public DateTime getStartDateWithTime() { DateMidnight date = getStartDate(); Time time = getStartTime(); if (date != null && time != null) { return date.toDateTime().withHourOfDay(time.getHours()).withMinuteOfHour(time.getMinutes()); } return null; }
@Override public PostingRule getPostingRule() { return getServiceAgreementTemplate().findPostingRuleByEventTypeAndDate(getEventType(), getExecutionYear().getBeginDateYearMonthDay().toDateMidnight().toDateTime().plusSeconds(1)); }