Rerun a saved stock screen and explain membership changes
A saved stock screen should preserve an executable rule and enough input context to explain the next result. Saving only the names makes a later addition look like a new opportunity even when it came from a changed universe or a corrected denominator. Run the same rule on two retained snapshots, compare membership, then connect each transition to its changed inputs.
This guide uses fictional prices and EPS values with a fixed positive-EPS rule. It measures screening changes, not historical investment performance. The local fixture is independent of CoTrading, whose corresponding saved-screen functionality is planned or unverified. A current universe cannot substitute for historical membership merely because the screen can be rerun.
Save rules and observations as separate objects
Our rule is eps > 0 AND price / eps < 20. Its identifier, operators and earnings definition remain fixed across both runs. Use a separate configuration version if the threshold or denominator changes. If two runs have different rules, describe the comparison as a rule experiment rather than a clean explanation of data-driven membership changes.
Each snapshot retains the full requested universe, including rejected rows. Keep price date, financial period, availability timestamp, source version and any known revision event. The SEC EDGAR API documentation describes updated filing and XBRL data, illustrating why a later retrieval need not reproduce an earlier input. It does not provide a historical earnings forecast archive; retain the actual data you used.
A correction event should come from a recorded source notice or explicit fixture metadata. An EPS value changing from 1.00 to 1.50 does not by itself reveal whether a new financial report, vendor correction or altered extraction caused it. Field-level attribution and economic-event attribution are separate layers. Mark the second unresolved if the evidence only supports the first.
Create two small, inspectable snapshots
The old universe contains AAA, BBB, CCC, DDD and FFF. The new universe contains AAA, BBB, DDD, EEE and FFF. All prices and per-share earnings use the same synthetic currency and denominator convention. BBB’s new EPS is explicitly tagged as a correction in the fixture, rather than inferred from the number.
| Stock | Old price / EPS | New price / EPS | Context |
|---|---|---|---|
| AAA | 18 / 1 | 22 / 1 | price update |
| BBB | 24 / 1 | 24 / 1.5 | recorded EPS correction |
| CCC | 15 / 1 | absent | removed from universe |
| DDD | 21 / 1 | 19 / 1 | price update |
| EEE | absent | 17 / 1 | added to universe |
| FFF | 10 / 1 | 10 / 1 | unchanged |
Before comparing results, run the old snapshot twice and assert identical membership. That tests deterministic execution on identical inputs. It does not establish that the inputs describe a genuine historical point in time; that requires the availability and membership evidence retained outside this tiny calculation.
Calculate the three membership tables
Evaluate both snapshots independently. The old passing set is AAA, CCC and FFF. The new passing set is BBB, DDD, EEE and FFF. Set differences create additions and removals; intersection creates retained members. Keep a stable display order so a changed provider row order does not look like a different result.
def run(snapshot):
return {symbol for symbol, row in snapshot.items()
if row["eps"] > 0 and row["price"] / row["eps"] < 20}
before, after = run(old), run(new)
added = sorted(after - before)
removed = sorted(before - after)
retained = sorted(before & after)
The complete standard-library example is docs/growth/research/round-5/examples/R523.py. Its executed output adds BBB, DDD and EEE, removes AAA and CCC, and retains FFF. Assertions verify both sets and the field causes. Python’s sorting documentation explains the deterministic ordering used for display. Sorting the result is a presentation decision; it does not assign research priority.
Download the complete example. Use Python 3.12+ with the standard library only; all inputs are synthetic. After downloading, run python R523.py.
Retain the nonpassing records as well. A stock that fails in both snapshots can still have an important input revision, and a retained stock can cross one condition while another compensates in a more complex rule. This article explains membership transitions; a full input-change report is a distinct, useful attachment.
Trace every transition before writing an explanation
AAA exits because its price moves from 18 to 22 with EPS fixed at 1. Its PE crosses from 18 to 22. DDD enters when price falls from 21 to 19, again with EPS fixed. BBB enters because the corrected denominator makes its ratio 16 instead of 24. The fixture records the correction event, so the explanation can say more than “EPS changed.”
CCC exits the candidate set because it is absent from the new universe. It did not fail the same numerical screen on a new observation. EEE enters because it was newly included and passes its first evaluated row. Label both transitions universe; describing them as improving or deteriorating fundamentals would invent evidence.
When multiple inputs change, list all changed fields and calculate counterfactuals with one old value restored at a time. If both price and EPS matter jointly, report joint dependence rather than selecting a convenient single cause. A condition crossing can be identifiable even when the upstream source event remains unresolved. Preserve that uncertainty beside the transition.
Test a different-mechanism failure
The universe-removal counterexample catches a mistake that simple numerical explanations miss. A naive comparison could fill CCC’s missing new row with zero EPS and label it a valuation failure. The correct branch checks membership before comparing fields. Its old result remains valid for the old universe; the new run simply did not evaluate CCC.
Similarly, a new source version is not necessarily a new economic disclosure. A vendor can reissue data with a corrected extraction. Store the source-event category and its supporting notice separately from the revision identifier. If only the revision identifier is known, publish “EPS changed; event unresolved” and add a follow-up task. Do not turn a data correction into a claim about earnings momentum.
Publish a comparison with a clear next action
The handoff contains the same-rule confirmation, two input references, additions, removals, retained members and per-transition causes. Reconcile counts: three old members minus two removals plus three additions equals four new members. Every symbol in a difference table must exist in at least one corresponding snapshot, and every retained symbol must pass both runs.
If a source correction changes an input used by the screen, rerun the affected rule and preserve both versions. If the user changes the rule, open a new rule version. If the universe changes, retain that fact even when it makes the candidate count more attractive. These practices make a saved screen a repeatable research operation whose membership changes can be explained without pretending that every change is a fresh market signal.
Separate comparison acceptance from interpretation
Before sharing the comparison, check that both snapshots satisfy the same field contract and that every transition has either a supported cause or an unresolved label. Keep the exact old and new values beside the cause. This lets another reviewer reproduce BBB’s change from 24 to 16 without searching through a narrative.
For a larger rule, retain condition-level results on both dates. A stock may continue to pass through a different alternative branch, so unchanged membership is insufficient to establish an unchanged rationale. Preserve the membership comparison and condition comparison as separate outputs.
When a later correction arrives, do not rewrite the already shared report in place. Create a revised run, identify the affected transitions and mark the earlier comparison as superseded where appropriate. The old snapshot remains evidence of what the earlier computation actually used, even if the source value was later corrected.
Describe the computation before proposing an economic explanation. AAA’s exit is attributable to price, but this comparison does not explain why its price rose. BBB’s recorded correction changes the denominator without demonstrating a new operating event. Preserve those distinctions when handing the change table to the researcher who will investigate the companies.
FAQ
Does identical membership mean the inputs were unchanged?
No. Inputs may change without crossing a rule boundary. Keep input differences separately.
Can a missing new row be called a rejection?
No. First determine whether the stock left the universe, failed retrieval or became unavailable. Those are different from an observed rule failure.