PyInvesting
Back to research notes

Methods and evidence

How PyInvesting builds a historical US stock universe

A historical stock universe asks which companies could have been considered at each past decision date. A fixed list asks how the instruments you selected performed over available history. Both can support research, but they answer different questions. Selecting today's survivors does not reconstruct a past investable market.

PyInvesting's optional Point-in-time US equities (PIT) mode builds monthly membership from stored historical records. Availability depends on the builder, account access, requested interval and qualifying coverage. This methodology describes the rules; it does not certify complete coverage for every date or claim that results are survivorship-bias-free.

Keep the observation date and information date separate

An as-of question, often written as_of, needs a precise cutoff: what information was available by that decision? A reporting period ending in December does not make an annual filing available in December. The source's available_at timestamp records when a value became available; the observation or effective date records what period or event it describes. Retrieval time records when PyInvesting obtained a record and is a separate part of its provenance.

For example, suppose an invented December share count is first published in February. It cannot inform a January month-end decision simply because its fiscal date is December. Later revisions also need their own timing and provenance. A publication date attached to a current value is weaker evidence than a preserved original filing; the result's evidence classes should be read with that distinction in mind.

How monthly membership is selected

The universe ranks at month-end close, and membership changes take effect in the next session. Candidate checks include supported US common-equity identity, the historical listing interval, a compatible historical price and publication-dated shares. Market capitalization uses the historical raw close and compatible shares, including the required split reconciliation, rather than today's shares. Eligible share classes are deduplicated by issuer before ranking.

Illustrative membership with entry rank 500 and exit rank 600
Prior membershipHistorical market-cap rankDecision if other checks pass
Outside universe480May enter next session.
Outside universe550Does not enter.
Existing member550Remains a member.
Existing member601Leaves the universe.

The optional minimum historical market cap is applied before ranking. Entry and exit ranks concern universe membership, not actual portfolio ownership. A relative strength strategy must still apply its moving-average and signal rules to choose holdings.

Listings and delisted companies need evidence

A company later delisted can be considered while its historical listing and required observations qualify. This does not mean every delisted security is present or every corporate outcome is supported. Ticker changes, share exchanges, cash exits and worthless cancellations require suitable identity and event evidence. A missing last price does not prove a zero-value exit or justify carrying a position forever.

The fixed-list instrument picker is also not a historical constituent database. Check exchange, currency and issuer identity in the US stock directory; do not treat a matching ticker alone as proof that two records represent the same security throughout the interval.

Coverage can reject a run

Historical preparation uses records already stored by PyInvesting. It does not fetch a missing market history from a provider when you submit. Inspect the requested and actual interval, expected and available refreshes, minimum/median/maximum rankable counts, evidence classes and exclusion reasons in the result. Enough names in a recent month does not prove that an earlier month qualifies.

Missing publication dates, incompatible shares or prices, unsupported listings and insufficient coverage can exclude candidates or block the run. Fail-closed checks mean the system stops when required qualification is missing instead of presenting an unqualified calculation as a completed result. They establish compliance with the implemented checks, not completeness of the underlying market archive.

A remaining source of selection bias: before simulation, unusable price histories are excluded using the full requested period. Later missing or invalid observations can therefore affect inclusion at earlier dates. This forward-looking exclusion step can introduce selection bias even when the monthly ranking uses information available at its own cutoff.

Preserve the run's source and configuration identities alongside the universe evidence and all exclusions. If the dates or exclusions change, treat the result as a different experiment. Open the builder to inspect the available universe controls, and read the research policy for how assumptions and corrections are documented.

Prepared with AI assistance. PyInvesting is responsible for this guide; see our editorial policy for sources, limitations and corrections.