Class UniverseCsvLoader

java.lang.Object
com.quantfinlib.data.UniverseCsvLoader

public final class UniverseCsvLoader extends Object
Loads a PointInTimeUniverse from a user-supplied CSV file — the defined interchange format for the membership/lifecycle data the engine cannot invent.

File format

Header (required, column order fixed):

 symbol,event,date,end_date,value,acquirer_shares,acquirer
 

One row per membership interval or lifecycle event:

 # comments and blank lines are ignored
 AAPL,MEMBER,2010-01-01,,,,                  <- member since date, still in
 YHOO,MEMBER,2000-01-03,2017-06-13,,,        <- left the index on end_date
 LEH,MEMBER,2000-01-03,2008-09-15,,,
 LEH,DELIST,2008-09-15,,-1.0,,               <- shareholders wiped out
 WCOM,DELIST,2002-07-01,,,,                  <- value empty: Shumway -30% default
 TWX,MERGER,2018-06-15,,48.53,0.5471,T       <- $48.53 + 0.5471 T shares per share
 
  • eventMEMBER, DELIST or MERGER (case-insensitive);
  • date / end_date — ISO dates (2018-06-15) or epoch numbers, converted exactly like CsvBarLoader bar timestamps (epoch millis internally), so universe dates and bar timestamps line up by construction. Empty end_date = open-ended membership;
  • value — DELIST: the delisting return (final-day return on the last close, −1 = worthless; empty defaults to PointInTimeUniverse.DEFAULT_INVOLUNTARY_DELISTING_RETURN); MERGER: cash per share (empty = 0);
  • acquirer_shares / acquirer — MERGER stock component (empty = all-cash deal).

Sourcing the data (honesty section)

Free constituent lists — e.g. datasets/s-and-p-500-companies — publish today's members: loading one gives every symbol an open-ended membership from your chosen start date, which reproduces the survivorship-biased universe (useful as a baseline to quantify the bias against, and the format accepts it). Removing the bias requires historical membership changes and delisting returns — CRSP, Norgate, Sharadar, or hand-curated index change announcements — expressed in this same format.