Skip to content

Commit 430dcf6

Browse files
authored
Localize mega-cap strategy status name (#165)
1 parent 5778dfa commit 430dcf6

5 files changed

Lines changed: 14 additions & 5 deletions

File tree

notifications/telegram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"strategy_name_russell_1000_multi_factor_defensive": "罗素1000多因子",
118118
"strategy_name_tech_communication_pullback_enhancement": "科技通信回调增强",
119119
"strategy_name_qqq_tech_enhancement": "科技通信回调增强",
120-
"strategy_name_mega_cap_leader_rotation_top50_balanced": "Mega Cap Top50 平衡龙头轮动",
120+
"strategy_name_mega_cap_leader_rotation_top50_balanced": "美股超大盘50强平衡龙头轮动",
121121
"strategy_name_hk_global_etf_tactical_rotation": "港股全球 ETF 战术轮动",
122122
"strategy_name_hk_dividend_gold_defensive_rotation": "港股股息黄金防守轮动",
123123
"strategy_name_hk_low_vol_dividend_quality_snapshot": "港股低波股息质量快照",

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
flask
22
gunicorn
3-
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@9d9682533578c7e5a9e02ea80040b7014898e4dd
4-
us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@c7a1ae5e804b720f2ab6412451b9e8ee3341ff20
3+
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@2a711adf60b585ca02932bab9ee1bac7ce1df7c6
4+
us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@085f6010883b3f7c66a1c16f96749c0251410f93
55
hk-equity-strategies @ git+https://github.com/QuantStrategyLab/HkEquityStrategies.git@196f16b63b39fc7f35db703a00a9344a1d1d2bb4
66
pandas
77
requests

scripts/print_strategy_profile_status.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def _print_table(rows: list[dict[str, object]]) -> None:
6969
headers = (
7070
"canonical_profile",
7171
"display_name",
72+
"display_name_zh",
7273
"profile_group",
7374
"input_mode",
7475
"requires_snapshot_artifacts",
@@ -90,7 +91,7 @@ def _print_table(rows: list[dict[str, object]]) -> None:
9091
def main() -> int:
9192
rows = build_status_rows()
9293
if "--json" in sys.argv:
93-
print(json.dumps(rows, indent=2, sort_keys=True))
94+
print(json.dumps(rows, ensure_ascii=False, indent=2, sort_keys=True))
9495
return 0
9596
_print_table(rows)
9697
return 0

tests/test_notifications.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def test_heartbeat_localizes_strategy_diagnostics_and_source_input_status(self):
326326
note_logs=(),
327327
translator=build_translator("zh"),
328328
separator="━━━━━━━━━━━━━━━━━━",
329-
strategy_display_name="Mega Cap Top50 平衡龙头轮动",
329+
strategy_display_name="美股超大盘50强平衡龙头轮动",
330330
dry_run_only=False,
331331
)
332332

tests/test_runtime_config_support.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,13 @@ def test_print_strategy_profile_status_json_matches_registry(self):
741741
for key in (
742742
"canonical_profile",
743743
"display_name",
744+
"display_name_zh",
744745
"domain",
745746
"eligible",
746747
"enabled",
747748
"platform",
748749
)
750+
if key in row
749751
}
750752
for row in rows
751753
],
@@ -758,6 +760,10 @@ def test_print_strategy_profile_status_json_matches_registry(self):
758760
self.assertFalse(by_profile["global_etf_rotation"]["requires_strategy_config_path"])
759761
self.assertNotIn("tech_communication_pullback_enhancement", by_profile)
760762
self.assertEqual(by_profile["mega_cap_leader_rotation_top50_balanced"]["profile_group"], "snapshot_backed")
763+
self.assertEqual(
764+
by_profile["mega_cap_leader_rotation_top50_balanced"]["display_name_zh"],
765+
"美股超大盘50强平衡龙头轮动",
766+
)
761767
self.assertEqual(by_profile["mega_cap_leader_rotation_top50_balanced"]["input_mode"], "feature_snapshot")
762768
self.assertTrue(by_profile["mega_cap_leader_rotation_top50_balanced"]["requires_snapshot_artifacts"])
763769
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):
788794

789795
self.assertIn("canonical_profile", result.stdout)
790796
self.assertIn("display_name", result.stdout)
797+
self.assertIn("display_name_zh", result.stdout)
791798
self.assertIn("profile_group", result.stdout)
792799
self.assertIn("input_mode", result.stdout)
793800
self.assertIn("requires_snapshot_artifacts", result.stdout)
@@ -801,6 +808,7 @@ def test_print_strategy_profile_status_table_contains_expected_headers(self):
801808
self.assertIn("HK Dividend-Gold Defensive Rotation", result.stdout)
802809
self.assertIn("Russell 1000 Multi-Factor", result.stdout)
803810
self.assertIn("Mega Cap Leader Rotation Top50 Balanced", result.stdout)
811+
self.assertIn("美股超大盘50强平衡龙头轮动", result.stdout)
804812
self.assertNotIn("Tech/Communication Pullback Enhancement", result.stdout)
805813
self.assertNotIn("hk_blue_chip_leader_rotation", result.stdout)
806814
self.assertNotIn("hk_index_mean_reversion", result.stdout)

0 commit comments

Comments
 (0)