Class FundamentalsHistory

java.lang.Object
com.quantfinlib.alpha.FundamentalsHistory

public final class FundamentalsHistory extends Object
Point-in-time fundamentals: every record is keyed by the time it became public, and asOf(String, long) returns only what was published by then.

A fundamentals snapshot taken today and used to score history is look-ahead: today's P/E is today's price over trailing earnings, so "cheap" in the snapshot means "fell over the sample" and a value backtest on it measures sample-path reversal. The fix is the publication date. A filing for the quarter ending periodEnd is not usable until it is released, typically 30 to 90 days later in US equities (the SEC 10-Q deadline is 40 to 45 days after quarter end, 10-K 60 to 90 days); research convention is to assume a conservative fixed lag when the true release date is unknown (Fama and French 1992 use a six-month lag on fiscal year-end accounting data).

Ratio fields (peRatio, pbRatio) are taken as recorded, that is, at the price on the record's own date. Factors.value() prefers eps / close(t) for the earnings yield when eps is present, so the price side updates every bar.

Timestamps use the same epoch units as the BarSeries panel. Not thread-safe while being filled; safe to share once filled.

  • Constructor Details

    • FundamentalsHistory

      public FundamentalsHistory()
      Creates an instance; the explicit form of the default constructor.
  • Method Details

    • add

      public FundamentalsHistory add(String symbol, long periodEnd, long publishedAt, Fundamentals fundamentals)
      Adds a record with its actual publication time.
      Parameters:
      periodEnd - end of the fiscal period the record describes
      publishedAt - when the record became public (>= periodEnd)
    • addWithLag

      public FundamentalsHistory addWithLag(String symbol, long periodEnd, long reportingLag, Fundamentals fundamentals)
      Adds a record whose release date is unknown, assuming it became public reportingLag after periodEnd.
    • asOf

      public Fundamentals asOf(String symbol, long timestamp)
      The latest record published at or before timestamp, or null when nothing about the symbol was public yet.
    • entries

      public List<FundamentalsHistory.Entry> entries(String symbol)
      All records for a symbol in publication order (unmodifiable).