Skip to content

Commit e103470

Browse files
authored
Rename Russell Top50 runtime profile
1 parent 3da651c commit e103470

10 files changed

Lines changed: 37 additions & 37 deletions

notifications/telegram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def format_small_account_cash_substitution_notes(
260260
"strategy_name_global_etf_confidence_vol_gate": "全球 ETF 置信波动门控",
261261
"strategy_name_tech_communication_pullback_enhancement": "科技通信回调增强",
262262
"strategy_name_qqq_tech_enhancement": "科技通信回调增强",
263-
"strategy_name_russell_top50_leader_rotation_aggressive": "罗素 Top50 领涨轮动(激进)",
263+
"strategy_name_russell_top50_leader_rotation": "罗素 Top50 领涨轮动",
264264
"strategy_name_ibit_smart_dca": "IBIT 比特币 ETF 智能定投",
265265
"skip_reason_below_trade_threshold": "低于调仓阈值",
266266
"skip_reason_quote_unavailable": "无法获取报价",
@@ -410,7 +410,7 @@ def format_small_account_cash_substitution_notes(
410410
"strategy_name_global_etf_confidence_vol_gate": "Global ETF Confidence Vol Gate",
411411
"strategy_name_tech_communication_pullback_enhancement": "Tech Communication Pullback Enhancement",
412412
"strategy_name_qqq_tech_enhancement": "Tech Communication Pullback Enhancement",
413-
"strategy_name_russell_top50_leader_rotation_aggressive": "Russell Top50 Leader Rotation Aggressive",
413+
"strategy_name_russell_top50_leader_rotation": "Russell Top50 Leader Rotation",
414414
"strategy_name_ibit_smart_dca": "IBIT Smart DCA",
415415
"skip_reason_below_trade_threshold": "below trade threshold",
416416
"skip_reason_quote_unavailable": "quote unavailable",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ authors = [
1515
dependencies = [
1616
"firstrade==0.0.39",
1717
"quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@b846c9d777a450e95d23c264853997d671f47dd9",
18-
"us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@d789c5cacea6b82cccc0202561bd53482294b14a",
18+
"us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@031a5bbd5a5ec64a57225a2b24f6569359dc9b11",
1919
"google-cloud-storage",
2020
"requests",
2121
]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ flask
22
gunicorn
33
firstrade==0.0.39
44
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@b846c9d777a450e95d23c264853997d671f47dd9
5-
us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@d789c5cacea6b82cccc0202561bd53482294b14a
5+
us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@031a5bbd5a5ec64a57225a2b24f6569359dc9b11
66
google-cloud-storage
77
google-auth
88
requests

strategy_runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _build_runtime_overrides(profile: str, runtime_settings: PlatformRuntimeSett
173173
if runtime_settings.qqqi_income_ratio is not None:
174174
overrides["qqqi_income_ratio"] = runtime_settings.qqqi_income_ratio
175175
if profile in {
176-
"russell_top50_leader_rotation_aggressive",
176+
"russell_top50_leader_rotation",
177177
"tech_communication_pullback_enhancement",
178178
}:
179179
if runtime_settings.runtime_execution_window_trading_days is not None:

tests/test_decision_mapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_applies_platform_reserved_cash_policy_to_weight_decision():
2626
plan = map_strategy_decision_to_plan(
2727
decision,
2828
snapshot=snapshot,
29-
strategy_profile="russell_top50_leader_rotation_aggressive",
29+
strategy_profile="russell_top50_leader_rotation",
3030
runtime_metadata={
3131
"firstrade_execution_policy": {
3232
"reserved_cash_floor_usd": 1500.0,
@@ -157,7 +157,7 @@ def test_value_decision_without_threshold_uses_platform_default():
157157
plan = map_strategy_decision_to_plan(
158158
decision,
159159
snapshot=snapshot,
160-
strategy_profile="russell_top50_leader_rotation_aggressive",
160+
strategy_profile="russell_top50_leader_rotation",
161161
)
162162

163163
assert plan["execution"]["trade_threshold_value"] == 200.0
@@ -181,7 +181,7 @@ def test_no_execute_decision_without_threshold_holds_current_positions():
181181
plan = map_strategy_decision_to_plan(
182182
decision,
183183
snapshot=snapshot,
184-
strategy_profile="russell_top50_leader_rotation_aggressive",
184+
strategy_profile="russell_top50_leader_rotation",
185185
)
186186

187187
assert plan["execution"]["trade_threshold_value"] == 100.0

tests/test_rebalance_service.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ def get_balances(self, _account):
254254
return {"cash_balance": "$1000.00", "buying_power": "$1000.00"}
255255

256256
class WeightTargetRuntime(FakeStrategyRuntime):
257-
profile = "russell_top50_leader_rotation_aggressive"
258-
display_name = "Russell Top50 Leader Rotation Aggressive"
257+
profile = "russell_top50_leader_rotation"
258+
display_name = "Russell Top50 Leader Rotation"
259259

260260
def evaluate(self, **inputs):
261261
assert "portfolio_snapshot" in inputs
@@ -276,8 +276,8 @@ def evaluate(self, **inputs):
276276

277277
result = run_strategy_cycle(
278278
runtime_settings=_runtime_settings_with_persistence(
279-
strategy_profile="russell_top50_leader_rotation_aggressive",
280-
strategy_display_name="Russell Top50 Leader Rotation Aggressive",
279+
strategy_profile="russell_top50_leader_rotation",
280+
strategy_display_name="Russell Top50 Leader Rotation",
281281
),
282282
credentials=FirstradeCredentials(username="user", password="pass"),
283283
client_factory=CashOnlyClient,
@@ -296,8 +296,8 @@ def get_balances(self, _account):
296296
return {"total_value": "$0.00", "cash_balance": "$0.00", "buying_power": "$0.00"}
297297

298298
class WeightTargetRuntime(FakeStrategyRuntime):
299-
profile = "russell_top50_leader_rotation_aggressive"
300-
display_name = "Russell Top50 Leader Rotation Aggressive"
299+
profile = "russell_top50_leader_rotation"
300+
display_name = "Russell Top50 Leader Rotation"
301301

302302
def evaluate(self, **inputs):
303303
assert "portfolio_snapshot" in inputs
@@ -318,8 +318,8 @@ def evaluate(self, **inputs):
318318

319319
result = run_strategy_cycle(
320320
runtime_settings=_runtime_settings_with_persistence(
321-
strategy_profile="russell_top50_leader_rotation_aggressive",
322-
strategy_display_name="Russell Top50 Leader Rotation Aggressive",
321+
strategy_profile="russell_top50_leader_rotation",
322+
strategy_display_name="Russell Top50 Leader Rotation",
323323
),
324324
credentials=FirstradeCredentials(username="user", password="pass"),
325325
client_factory=ZeroEquityClient,
@@ -938,8 +938,8 @@ def test_render_cycle_summary_shows_funding_blocked_banner():
938938
message = render_cycle_summary(
939939
{
940940
"account": "****1234",
941-
"strategy_profile": "russell_top50_leader_rotation_aggressive",
942-
"strategy_display_name": "Russell Top50 Leader Rotation Aggressive",
941+
"strategy_profile": "russell_top50_leader_rotation",
942+
"strategy_display_name": "Russell Top50 Leader Rotation",
943943
"dry_run_only": False,
944944
"execution_blocked": True,
945945
"execution_block_retryable": False,
@@ -971,8 +971,8 @@ def test_render_cycle_summary_shows_retryable_execution_blocked_banner():
971971
message = render_cycle_summary(
972972
{
973973
"account": "****1234",
974-
"strategy_profile": "russell_top50_leader_rotation_aggressive",
975-
"strategy_display_name": "Russell Top50 Leader Rotation Aggressive",
974+
"strategy_profile": "russell_top50_leader_rotation",
975+
"strategy_display_name": "Russell Top50 Leader Rotation",
976976
"dry_run_only": False,
977977
"execution_blocked": True,
978978
"execution_block_retryable": True,

tests/test_request_handling.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def send(message):
192192
monkeypatch.setenv("GLOBAL_TELEGRAM_CHAT_ID", "chat-1")
193193
monkeypatch.setenv("STRATEGY_PLUGIN_ALERT_TELEGRAM_BOT_TOKEN", "plugin-token")
194194
monkeypatch.setenv("STRATEGY_PLUGIN_ALERT_TELEGRAM_CHAT_IDS", "plugin-chat")
195-
monkeypatch.setenv("STRATEGY_PROFILE", "russell_top50_leader_rotation_aggressive")
195+
monkeypatch.setenv("STRATEGY_PROFILE", "russell_top50_leader_rotation")
196196
monkeypatch.setattr(main, "build_sender", fake_build_sender)
197197
monkeypatch.setattr(
198198
main,
@@ -213,15 +213,15 @@ def send(message):
213213
assert sent_messages[0][1] == "chat-1"
214214
assert "Firstrade strategy run failed" in sent_messages[0][2]
215215
assert "ValueError: snapshot denied" in sent_messages[0][2]
216-
assert "strategy: russell_top50_leader_rotation_aggressive" in sent_messages[0][2]
216+
assert "strategy: russell_top50_leader_rotation" in sent_messages[0][2]
217217

218218

219219
def test_run_endpoint_error_notification_uses_chinese_copy(monkeypatch):
220220
monkeypatch.setenv("FIRSTRADE_RUN_STRATEGY_ON_HTTP", "true")
221221
monkeypatch.setenv("TELEGRAM_TOKEN", "token-1")
222222
monkeypatch.setenv("GLOBAL_TELEGRAM_CHAT_ID", "chat-1")
223223
monkeypatch.setenv("NOTIFY_LANG", "zh")
224-
monkeypatch.setenv("STRATEGY_PROFILE", "russell_top50_leader_rotation_aggressive")
224+
monkeypatch.setenv("STRATEGY_PROFILE", "russell_top50_leader_rotation")
225225
sent_messages = []
226226

227227
def fake_build_sender(token, chat_id):
@@ -243,7 +243,7 @@ def send(message):
243243
assert response.status_code == 500
244244
text = sent_messages[0][2]
245245
assert "Firstrade 策略运行失败" in text
246-
assert "策略: russell_top50_leader_rotation_aggressive" in text
246+
assert "策略: russell_top50_leader_rotation" in text
247247
assert "错误: ValueError: snapshot denied" in text
248248

249249

tests/test_runtime_config_support.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
)
1111

1212

13-
def _target_json(profile="russell_top50_leader_rotation_aggressive") -> str:
13+
def _target_json(profile="russell_top50_leader_rotation") -> str:
1414
return (
1515
'{"platform_id":"firstrade","strategy_profile":"'
1616
+ profile
@@ -23,7 +23,7 @@ def test_runtime_execution_window_uses_generic_env(monkeypatch):
2323
monkeypatch.setenv("FIRSTRADE_TECH_RUNTIME_EXECUTION_WINDOW_TRADING_DAYS", "3")
2424

2525
assert (
26-
_runtime_execution_window_trading_days_env("russell_top50_leader_rotation_aggressive")
26+
_runtime_execution_window_trading_days_env("russell_top50_leader_rotation")
2727
== 7
2828
)
2929
assert (
@@ -41,7 +41,7 @@ def test_runtime_execution_window_keeps_legacy_tech_env(monkeypatch):
4141
== 5
4242
)
4343
assert (
44-
_runtime_execution_window_trading_days_env("russell_top50_leader_rotation_aggressive")
44+
_runtime_execution_window_trading_days_env("russell_top50_leader_rotation")
4545
is None
4646
)
4747

@@ -255,4 +255,4 @@ def test_runtime_execution_window_rejects_invalid_generic_env(monkeypatch, raw_v
255255
ValueError,
256256
match="FIRSTRADE_RUNTIME_EXECUTION_WINDOW_TRADING_DAYS",
257257
):
258-
_runtime_execution_window_trading_days_env("russell_top50_leader_rotation_aggressive")
258+
_runtime_execution_window_trading_days_env("russell_top50_leader_rotation")

tests/test_session_check_service.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_run_session_check_persists_funds_snapshot_when_enabled():
112112
def test_monthly_session_check_skips_when_current_period_is_already_maintained():
113113
now = datetime(2026, 6, 3, 1, 2, 3, tzinfo=timezone.utc)
114114
state_key = (
115-
"session-checks/auto/russell_top50_leader_rotation_aggressive/2026_06/latest.json"
115+
"session-checks/auto/russell_top50_leader_rotation/2026_06/latest.json"
116116
)
117117
store = FakeStateStore(
118118
{
@@ -126,7 +126,7 @@ def test_monthly_session_check_skips_when_current_period_is_already_maintained()
126126
result = run_session_check(
127127
client_factory=ExplodingClient,
128128
state_store=store,
129-
env_reader=_env({"STRATEGY_PROFILE": "russell_top50_leader_rotation_aggressive"}),
129+
env_reader=_env({"STRATEGY_PROFILE": "russell_top50_leader_rotation"}),
130130
now=now,
131131
)
132132

@@ -147,14 +147,14 @@ def test_monthly_session_check_runs_and_persists_maintenance_state_when_due():
147147
credentials=FirstradeCredentials(username="user", password="pass"),
148148
client_factory=FakeClient,
149149
state_store=store,
150-
env_reader=_env({"STRATEGY_PROFILE": "russell_top50_leader_rotation_aggressive"}),
150+
env_reader=_env({"STRATEGY_PROFILE": "russell_top50_leader_rotation"}),
151151
now=now,
152152
)
153153

154154
assert result["ok"] is True
155155
assert result["session_check_maintenance_state_persisted"] is True
156156
state_key = (
157-
"session-checks/auto/russell_top50_leader_rotation_aggressive/2026_06/latest.json"
157+
"session-checks/auto/russell_top50_leader_rotation/2026_06/latest.json"
158158
)
159159
assert store.reads == [state_key]
160160
assert store.writes == [
@@ -164,7 +164,7 @@ def test_monthly_session_check_runs_and_persists_maintenance_state_when_due():
164164
"checked_at": "2026-06-03T01:02:03+00:00",
165165
"account": "****5678",
166166
"session_reused": True,
167-
"strategy_profile": "russell_top50_leader_rotation_aggressive",
167+
"strategy_profile": "russell_top50_leader_rotation",
168168
"strategy_cadence": "monthly",
169169
"strategy_required_inputs": ["feature_snapshot"],
170170
"period": "2026-06",
@@ -196,7 +196,7 @@ def test_daily_session_check_runs_every_time_without_maintenance_state_lookup():
196196
def test_session_check_policy_always_overrides_monthly_throttle():
197197
now = datetime(2026, 6, 3, 1, 2, 3, tzinfo=timezone.utc)
198198
state_key = (
199-
"session-checks/auto/russell_top50_leader_rotation_aggressive/2026_06/latest.json"
199+
"session-checks/auto/russell_top50_leader_rotation/2026_06/latest.json"
200200
)
201201
store = FakeStateStore({state_key: {"checked_at": "2026-06-01T01:02:03+00:00"}})
202202

@@ -206,7 +206,7 @@ def test_session_check_policy_always_overrides_monthly_throttle():
206206
state_store=store,
207207
env_reader=_env(
208208
{
209-
"STRATEGY_PROFILE": "russell_top50_leader_rotation_aggressive",
209+
"STRATEGY_PROFILE": "russell_top50_leader_rotation",
210210
"FIRSTRADE_SESSION_CHECK_POLICY": "always",
211211
}
212212
),

tests/test_strategy_runtime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def _runtime_settings(**overrides) -> PlatformRuntimeSettings:
99
"project_id": None,
1010
"account_prefix": "FIRSTRADE",
1111
"account_region": "US",
12-
"strategy_profile": "russell_top50_leader_rotation_aggressive",
12+
"strategy_profile": "russell_top50_leader_rotation",
1313
"strategy_display_name": "Mega Cap Leader Rotation Top 50 Balanced",
1414
"strategy_domain": "us_equity",
1515
"notify_lang": "en",
@@ -29,7 +29,7 @@ def test_runtime_execution_window_override_applies_to_mega_strategy():
2929
settings = _runtime_settings(runtime_execution_window_trading_days=7)
3030

3131
assert _build_runtime_overrides(
32-
"russell_top50_leader_rotation_aggressive",
32+
"russell_top50_leader_rotation",
3333
settings,
3434
) == {"runtime_execution_window_trading_days": 7}
3535

0 commit comments

Comments
 (0)