diff --git a/src/market/tiingo.py b/src/market/tiingo.py index 55256ef..20f23fe 100644 --- a/src/market/tiingo.py +++ b/src/market/tiingo.py @@ -90,7 +90,8 @@ def fts_qualifies(best_rank: int, n_targets: int, sic: str) -> bool: - A healthcare-services SIC (80xx, 6324) qualifies. - A pharma or device SIC (:data:`PHARMA_DEVICE_SICS`) needs a - ``revenue_exposure`` link or at least two distinct targets. + ``revenue_exposure`` link (M18: two targets prove nothing, since MACRA + boilerplate names the PFS and QPP together). - Any other SIC needs a ``revenue_exposure`` link. A bare single-target mention, and a generic ``risk_factor`` line from a @@ -99,7 +100,7 @@ def fts_qualifies(best_rank: int, n_targets: int, sic: str) -> bool: if is_services_sic(sic): return True if sic in PHARMA_DEVICE_SICS: - return revenue or n_targets >= 2 + return revenue return revenue diff --git a/tests/market/test_tiingo.py b/tests/market/test_tiingo.py index 32b034a..148de2e 100644 --- a/tests/market/test_tiingo.py +++ b/tests/market/test_tiingo.py @@ -199,7 +199,7 @@ def _universe_db(): entity("MEN2", "2834") entity("SVC", "8082") entity("RISK", "3841") # a device maker with one generic risk_factor - entity("MEN", "2834") # pharma with two targets + entity("MEN", "2834") # pharma with two targets: still needs revenue tenk("MEN", date(2020, 1, 1)) tenk("MEN2", date(2025, 1, 1)) return con @@ -232,8 +232,8 @@ def test_universe_ranked_capped_excludes_sic_only(): kw = {"supported": SUPPORTED, "seed_order": ["SEED"]} got = [t for t, _ in TI.universe(con, used=set(), **kw)] assert got[:3] == ["SPY", "XLV", "IHF"] - # ranked by strongest link, then targets: REV, MEN (2 targets), SVC - assert got[3:] == ["SEEDC", "REVC", "MENC", "SVCC"] + # ranked by strongest link, then targets: REV, SVC + assert got[3:] == ["SEEDC", "REVC", "SVCC"] for out in ( "SICC", "OLDC", @@ -244,13 +244,14 @@ def test_universe_ranked_capped_excludes_sic_only(): "REVCW", "REVCP", "RISK", + "MENC", # pharma, two mention targets (M18) ): assert out not in got keys = dict(TI.universe(con, used=set(), **kw)) assert keys["REVC"] == "REV" and keys["SPY"] == "index:SPY" assert [t for t, _ in TI.universe(con, used=set(), cap=5, **kw)] == got[:5] - capped = [t for t, _ in TI.universe(con, used={"SPY"}, cap=5, **kw)] - assert capped[:2] == ["SPY", "XLV"] and len(capped) == 6 + capped = [t for t, _ in TI.universe(con, used={"SPY"}, cap=4, **kw)] + assert capped[:2] == ["SPY", "XLV"] and len(capped) == 5 assert "SEEDC" in capped and "REVC" in capped and "SVCC" not in capped @@ -276,9 +277,10 @@ def test_is_common_share(): def test_fts_gate(): q = TI.fts_qualifies for sic in ("2834", "2835", "2836", "3841", "3842", "3844", "3845"): - # pharma and device: revenue_exposure or two targets - assert q(0, 1, sic) and q(2, 2, sic) and q(1, 2, sic) - assert not q(1, 1, sic) and not q(2, 1, sic) # generic risk_factor + # pharma and device: revenue_exposure only (M18), however many targets + assert q(0, 1, sic) and q(0, 2, sic) + assert not q(1, 1, sic) and not q(2, 1, sic) + assert not q(1, 2, sic) and not q(2, 4, sic) # generic MACRA boilerplate for sic in ("", "5047", "6798", "2711"): # any other SIC: revenue_exposure only, however many targets assert q(0, 1, sic) and not q(1, 1, sic) and not q(1, 3, sic)