Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions notify_i18n_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": "加密领涨轮动",
},
}
Expand Down
2 changes: 1 addition & 1 deletion requirements-lock.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 9 additions & 0 deletions tests/test_notify_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 = []
Expand Down
15 changes: 15 additions & 0 deletions tests/test_runtime_config_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down