sim_platform.research.universe¶
Point-in-time index membership, to choose test symbols without survivorship bias.
Picking today’s index members and testing them over past years keeps only the companies that survived and grew, which inflates every strategy’s results. A membership file lists when each symbol joined and left the universe (an index, a liquidity screen), so the symbols for a test window are the members on its first day, including those later delisted or dropped.
CSV columns: symbol, start_date and optional end_date (the first day the
symbol was no longer a member; empty while it still is) and reason (for example
delisted or acquired).
- class sim_platform.research.universe.Membership(symbol: 'str', start: 'date', end: 'Optional[date]', reason: 'str' = '')[source]¶
Bases:
object- Parameters:
symbol (str)
start (date)
end (date | None)
reason (str)
- symbol: str¶
- start: date¶
- end: date | None¶
- reason: str = ''¶
- sim_platform.research.universe.load_membership(path)[source]¶
Read a membership CSV; a symbol may have several spells.
- Raises:
ContractError – If a column is missing, a date is invalid or a spell ends before it starts (names the row).
- Parameters:
path (str | PathLike[str])
- Return type:
List[Membership]
- sim_platform.research.universe.members_on(spells, day)[source]¶
Symbols that were members on
day(YYYY-MM-DD), including later leavers.- Parameters:
spells (Iterable[Membership])
day (str)
- Return type:
List[str]
- sim_platform.research.universe.survivorship_check(spells, symbols, start, end)[source]¶
Compare chosen
symbolswith the universe over a test window [start, end].Returns
not_members(chosen symbols that were not members on the first day: they were picked with later knowledge),left_during(members on the first day that left beforeend, with their reason) andmissing_leavers(those leavers that are absent fromsymbols: their omission is survivorship bias).- Parameters:
spells (Iterable[Membership])
symbols (Iterable[str])
start (str)
end (str)
- Return type:
Dict[str, Any]