refactor(selection): replace concept sector filter with sub-industry
- pin the selection sector vocabulary to industry: the /sectors endpoint no longer accepts sector_type, and the port, adapter, and use case all resolve counts and member codes with sector_type="industry" - relabel the results filter to 细分行业 and drop concept-type plumbing from the frontend API, query keys, and types - show only 细分行业 in the signal detail panel; remove the concept-board chips and keep the snapshot-date tooltip on the industry line - update backend and frontend tests to the industry vocabulary and record the revised scope in the task PRD
This commit is contained in:
@@ -49,7 +49,7 @@ class FakeSectorReader:
|
||||
stock_codes: Sequence[str],
|
||||
target_trade_date: date,
|
||||
*,
|
||||
sector_type: str = "concept",
|
||||
sector_type: str = "industry",
|
||||
) -> SelectionSectorMembership:
|
||||
self.count_calls.append((tuple(stock_codes), target_trade_date, sector_type))
|
||||
return SelectionSectorMembership(
|
||||
@@ -62,7 +62,7 @@ class FakeSectorReader:
|
||||
target_trade_date: date,
|
||||
sector_code: str,
|
||||
*,
|
||||
sector_type: str = "concept",
|
||||
sector_type: str = "industry",
|
||||
) -> tuple[str, ...]:
|
||||
self.member_calls.append((target_trade_date, sector_code, sector_type))
|
||||
return self.member_codes
|
||||
@@ -161,9 +161,9 @@ def test_list_sector_counts_aggregates_only_selected_stocks() -> None:
|
||||
aggregates = service.list_sector_counts("zhixing_b1")
|
||||
|
||||
assert isinstance(aggregates, SelectionSectorAggregates)
|
||||
assert sector_reader.count_calls == [(("000001.SZ", "000002.SZ"), TARGET, "concept")]
|
||||
assert sector_reader.count_calls == [(("000001.SZ", "000002.SZ"), TARGET, "industry")]
|
||||
assert aggregates.snapshot_trade_date == TARGET
|
||||
assert aggregates.sector_type == "concept"
|
||||
assert aggregates.sector_type == "industry"
|
||||
assert aggregates.sectors == sector_reader.counts
|
||||
assert aggregates.run is store.run
|
||||
|
||||
@@ -198,7 +198,7 @@ def test_get_latest_resolves_sector_filter_against_run_snapshot() -> None:
|
||||
)
|
||||
|
||||
assert run is store.run
|
||||
assert sector_reader.member_calls == [(TARGET, "BK0001.DC", "concept")]
|
||||
assert sector_reader.member_calls == [(TARGET, "BK0001.DC", "industry")]
|
||||
assert store.sector_codes_seen == ("000001.SZ", "000002.SZ")
|
||||
assert store.queries[-1].sector is None
|
||||
assert store.queries[-1].page == 2
|
||||
@@ -239,7 +239,7 @@ def test_get_run_resolves_sector_filter_against_run_snapshot() -> None:
|
||||
run = service.get_run("run-1", query=SelectionResultQuery(sector="BK0001.DC"))
|
||||
|
||||
assert run is store.run
|
||||
assert sector_reader.member_calls == [(TARGET, "BK0001.DC", "concept")]
|
||||
assert sector_reader.member_calls == [(TARGET, "BK0001.DC", "industry")]
|
||||
assert store.sector_codes_seen == ("000001.SZ",)
|
||||
|
||||
|
||||
@@ -251,14 +251,3 @@ def test_get_latest_without_run_and_sector_filter_returns_none() -> None:
|
||||
)
|
||||
|
||||
assert service.get_latest("zhixing_b1", query=SelectionResultQuery(sector="BK0001.DC")) is None
|
||||
|
||||
|
||||
def test_list_sector_counts_accepts_industry_type() -> None:
|
||||
sector_reader = FakeSectorReader()
|
||||
service = RunZhixingB1(FakeReader(), FakeStore(_run()), sector_reader=sector_reader)
|
||||
|
||||
aggregates = service.list_sector_counts("zhixing_b1", sector_type="industry")
|
||||
|
||||
assert aggregates is not None
|
||||
assert aggregates.sector_type == "industry"
|
||||
assert sector_reader.count_calls == [(("000001.SZ", "000002.SZ"), TARGET, "industry")]
|
||||
|
||||
Reference in New Issue
Block a user