From f9b99f52d65beb95eac680465b1b90b1b27adebd Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Thu, 18 Jun 2026 15:52:41 +0800 Subject: [PATCH] Localize mega-cap strategy status name --- notifications/telegram.py | 2 +- requirements.txt | 4 ++-- scripts/print_strategy_profile_status.py | 3 ++- tests/test_notifications.py | 2 +- tests/test_runtime_config_support.py | 8 ++++++++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/notifications/telegram.py b/notifications/telegram.py index 42548ff..1095eb3 100644 --- a/notifications/telegram.py +++ b/notifications/telegram.py @@ -117,7 +117,7 @@ "strategy_name_russell_1000_multi_factor_defensive": "罗素1000多因子", "strategy_name_tech_communication_pullback_enhancement": "科技通信回调增强", "strategy_name_qqq_tech_enhancement": "科技通信回调增强", - "strategy_name_mega_cap_leader_rotation_top50_balanced": "Mega Cap Top50 平衡龙头轮动", + "strategy_name_mega_cap_leader_rotation_top50_balanced": "美股超大盘50强平衡龙头轮动", "strategy_name_hk_global_etf_tactical_rotation": "港股全球 ETF 战术轮动", "strategy_name_hk_dividend_gold_defensive_rotation": "港股股息黄金防守轮动", "strategy_name_hk_low_vol_dividend_quality_snapshot": "港股低波股息质量快照", diff --git a/requirements.txt b/requirements.txt index a5b3b85..f39df2a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ flask gunicorn -quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@9d9682533578c7e5a9e02ea80040b7014898e4dd -us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@c7a1ae5e804b720f2ab6412451b9e8ee3341ff20 +quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@2a711adf60b585ca02932bab9ee1bac7ce1df7c6 +us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@085f6010883b3f7c66a1c16f96749c0251410f93 hk-equity-strategies @ git+https://github.com/QuantStrategyLab/HkEquityStrategies.git@196f16b63b39fc7f35db703a00a9344a1d1d2bb4 pandas requests diff --git a/scripts/print_strategy_profile_status.py b/scripts/print_strategy_profile_status.py index 8767560..4b14a47 100644 --- a/scripts/print_strategy_profile_status.py +++ b/scripts/print_strategy_profile_status.py @@ -69,6 +69,7 @@ def _print_table(rows: list[dict[str, object]]) -> None: headers = ( "canonical_profile", "display_name", + "display_name_zh", "profile_group", "input_mode", "requires_snapshot_artifacts", @@ -90,7 +91,7 @@ def _print_table(rows: list[dict[str, object]]) -> None: def main() -> int: rows = build_status_rows() if "--json" in sys.argv: - print(json.dumps(rows, indent=2, sort_keys=True)) + print(json.dumps(rows, ensure_ascii=False, indent=2, sort_keys=True)) return 0 _print_table(rows) return 0 diff --git a/tests/test_notifications.py b/tests/test_notifications.py index ec4d3bc..ee86819 100644 --- a/tests/test_notifications.py +++ b/tests/test_notifications.py @@ -326,7 +326,7 @@ def test_heartbeat_localizes_strategy_diagnostics_and_source_input_status(self): note_logs=(), translator=build_translator("zh"), separator="━━━━━━━━━━━━━━━━━━", - strategy_display_name="Mega Cap Top50 平衡龙头轮动", + strategy_display_name="美股超大盘50强平衡龙头轮动", dry_run_only=False, ) diff --git a/tests/test_runtime_config_support.py b/tests/test_runtime_config_support.py index 929ecbb..cb6d378 100644 --- a/tests/test_runtime_config_support.py +++ b/tests/test_runtime_config_support.py @@ -741,11 +741,13 @@ def test_print_strategy_profile_status_json_matches_registry(self): for key in ( "canonical_profile", "display_name", + "display_name_zh", "domain", "eligible", "enabled", "platform", ) + if key in row } for row in rows ], @@ -758,6 +760,10 @@ def test_print_strategy_profile_status_json_matches_registry(self): self.assertFalse(by_profile["global_etf_rotation"]["requires_strategy_config_path"]) self.assertNotIn("tech_communication_pullback_enhancement", by_profile) self.assertEqual(by_profile["mega_cap_leader_rotation_top50_balanced"]["profile_group"], "snapshot_backed") + self.assertEqual( + by_profile["mega_cap_leader_rotation_top50_balanced"]["display_name_zh"], + "美股超大盘50强平衡龙头轮动", + ) self.assertEqual(by_profile["mega_cap_leader_rotation_top50_balanced"]["input_mode"], "feature_snapshot") self.assertTrue(by_profile["mega_cap_leader_rotation_top50_balanced"]["requires_snapshot_artifacts"]) self.assertFalse(by_profile["mega_cap_leader_rotation_top50_balanced"]["requires_strategy_config_path"]) @@ -788,6 +794,7 @@ def test_print_strategy_profile_status_table_contains_expected_headers(self): self.assertIn("canonical_profile", result.stdout) self.assertIn("display_name", result.stdout) + self.assertIn("display_name_zh", result.stdout) self.assertIn("profile_group", result.stdout) self.assertIn("input_mode", result.stdout) self.assertIn("requires_snapshot_artifacts", result.stdout) @@ -801,6 +808,7 @@ def test_print_strategy_profile_status_table_contains_expected_headers(self): self.assertIn("HK Dividend-Gold Defensive Rotation", result.stdout) self.assertIn("Russell 1000 Multi-Factor", result.stdout) self.assertIn("Mega Cap Leader Rotation Top50 Balanced", result.stdout) + self.assertIn("美股超大盘50强平衡龙头轮动", result.stdout) self.assertNotIn("Tech/Communication Pullback Enhancement", result.stdout) self.assertNotIn("hk_blue_chip_leader_rotation", result.stdout) self.assertNotIn("hk_index_mean_reversion", result.stdout)