Class UniverseCsvLoader
java.lang.Object
com.quantfinlib.data.UniverseCsvLoader
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
- event —
MEMBER,DELISTorMERGER(case-insensitive); - date / end_date — ISO dates (
2018-06-15) or epoch numbers, converted exactly likeCsvBarLoaderbar timestamps (epoch millis internally), so universe dates and bar timestamps line up by construction. Emptyend_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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PointInTimeUniverseLoads a universe file (see the class doc for the format).static PointInTimeUniverseParses in-memory lines — same format, no file required (tests, HTTP).
-
Method Details
-
load
Loads a universe file (see the class doc for the format).- Throws:
IOException
-
parse
Parses in-memory lines — same format, no file required (tests, HTTP).
-