diff --git a/notify_i18n_support.py b/notify_i18n_support.py index 556423c..b385746 100644 --- a/notify_i18n_support.py +++ b/notify_i18n_support.py @@ -129,6 +129,7 @@ "usdt_unavailable_for_trend_buy": "USDT unavailable for trend buy", "usdt_unavailable_for_btc_dca_buy": "USDT unavailable for BTC DCA buy", "btc_unavailable_for_dca_sell": "BTC unavailable for DCA sell", + "strategy_name_crypto_leader_rotation": "Crypto Leader Rotation", "strategy_name_crypto_live_pool_rotation": "Crypto Live Pool Rotation", }, "zh": { @@ -253,6 +254,7 @@ "usdt_unavailable_for_trend_buy": "USDT 不足,无法执行趋势买入", "usdt_unavailable_for_btc_dca_buy": "USDT 不足,无法执行 BTC 定投买入", "btc_unavailable_for_dca_sell": "BTC 不足,无法执行定投止盈卖出", + "strategy_name_crypto_leader_rotation": "加密领涨轮动", "strategy_name_crypto_live_pool_rotation": "加密领涨轮动", }, } diff --git a/requirements-lock.txt b/requirements-lock.txt index b75feae..02621ce 100644 --- a/requirements-lock.txt +++ b/requirements-lock.txt @@ -1,5 +1,5 @@ quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@v0.7.35 -crypto-strategies @ git+https://github.com/QuantStrategyLab/CryptoStrategies.git@v0.4.7 +crypto-strategies @ git+https://github.com/QuantStrategyLab/CryptoStrategies.git@v0.4.8 python-binance==1.0.36 pandas==3.0.3 numpy==2.4.6 diff --git a/requirements.txt b/requirements.txt index 9a25ce6..89a21b2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@v0.7.35 -crypto-strategies @ git+https://github.com/QuantStrategyLab/CryptoStrategies.git@v0.4.7 +crypto-strategies @ git+https://github.com/QuantStrategyLab/CryptoStrategies.git@v0.4.8 python-binance pandas numpy diff --git a/tests/test_notify_i18n.py b/tests/test_notify_i18n.py index 6bd1caa..57daefb 100644 --- a/tests/test_notify_i18n.py +++ b/tests/test_notify_i18n.py @@ -79,6 +79,7 @@ def set(self, *args, **kwargs): import main from degraded_mode_support import format_trend_pool_source_logs from market_snapshot_support import capture_market_snapshot +from notify_i18n_support import build_strategy_display_name, build_translator class FakeClient: @@ -90,6 +91,14 @@ def get_avg_price(self, *, symbol): class NotifyI18nTests(unittest.TestCase): + def test_legacy_strategy_profile_uses_chinese_display_name(self): + display_name = build_strategy_display_name(build_translator("zh"))( + "crypto_leader_rotation", + fallback_name="Crypto Leader Rotation", + ) + + self.assertEqual(display_name, "加密领涨轮动") + def test_periodic_btc_status_report_uses_chinese_when_notify_lang_is_zh(self): state = {} messages = [] diff --git a/tests/test_runtime_config_support.py b/tests/test_runtime_config_support.py index 3613bef..ad90512 100644 --- a/tests/test_runtime_config_support.py +++ b/tests/test_runtime_config_support.py @@ -62,6 +62,21 @@ def test_load_cycle_execution_settings_rejects_unknown_strategy_profile(self): with self.assertRaisesRegex(ValueError, "Unsupported STRATEGY_PROFILE"): load_cycle_execution_settings() + def test_load_cycle_execution_settings_accepts_legacy_profile_alias(self): + with patch.dict( + os.environ, + { + "STRATEGY_PROFILE": "crypto_leader_rotation", + "NOTIFY_LANG": "zh", + }, + clear=False, + ): + settings = load_cycle_execution_settings() + + self.assertEqual(settings.strategy_profile, DEFAULT_STRATEGY_PROFILE) + self.assertEqual(settings.strategy_display_name, "Crypto Live Pool Rotation") + self.assertEqual(settings.strategy_display_name_localized, "加密领涨轮动") + def test_platform_supported_profiles_are_filtered_by_registry(self): self.assertEqual( get_supported_profiles_for_platform(BINANCE_PLATFORM),