Class CalendarAnomalies

java.lang.Object
com.quantfinlib.alpha.CalendarAnomalies

public final class CalendarAnomalies extends Object
Calendar anomaly profiles — day-of-week and turn-of-month seasonality with the t-statistics that keep them honest. The honest part is the POINT: most published calendar anomalies (the weekend effect, the January effect) decayed or died after publication, and the difference between a tradable seasonal and a data-mined ghost is a t-stat that survives out of sample. This class hands you the profile AND the significance; treat |t| < 2 as decoration, and re-test out of sample before believing anything (see AlphaValidation).

Turn-of-month windows use CALENDAR days of month (last daysBeforeMonthEnd calendar days + first daysAfterMonthStart), not trading days — stated, not hidden; with daily equity data the difference is a day around holidays. Timestamps are interpreted in UTC. Static, deterministic, research lane.

  • Method Details

    • dayOfWeek

      public static CalendarAnomalies.DayOfWeekProfile dayOfWeek(double[] returns, long[] epochMillis)
      Parameters:
      returns - per-period returns aligned with epochMillis
    • turnOfMonth

      public static CalendarAnomalies.TurnOfMonth turnOfMonth(double[] returns, long[] epochMillis, int daysBeforeMonthEnd, int daysAfterMonthStart)
      Parameters:
      daysBeforeMonthEnd - calendar days at month end in the window, ≥ 0
      daysAfterMonthStart - calendar days at month start in the window, ≥ 0 (at least one of the two > 0)