Skip to content

Commit 7fbcd8e

Browse files
Pigbibiclaude
andauthored
fix: add combo profile to test expectations and live-enable matrix (#57)
- Add HK_EQUITY_COMBO_PROFILE imports and expected sets in catalog tests - Update build_live_enablement_matrix() to include combo profiles - Fix profile_count/selectable_profile_count assertions - Add HK_EQUITY_COMBO_PROFILE to PROFILE_LIVE_ENABLEMENT_THRESHOLDS Co-authored-by: Claude <noreply@anthropic.com>
1 parent 730b0e8 commit 7fbcd8e

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/hk_equity_strategies/live_enablement_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ def build_live_enablement_row(profile: str) -> dict[str, Any]:
611611

612612

613613
def build_live_enablement_matrix() -> dict[str, Any]:
614-
runtime_profiles = set(get_direct_market_history_profiles()) | set(get_snapshot_backed_profiles())
614+
runtime_profiles = set(get_runtime_enabled_profiles())
615615
runtime_rows = [_runtime_row(profile).as_dict() for profile in sorted(runtime_profiles)]
616616
research_rows = [_research_only_row(profile).as_dict() for profile in sorted(get_research_backtest_only_profiles())]
617617
snapshot_rows = [

src/hk_equity_strategies/runtime_readiness.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from hk_equity_strategies.runtime_etf_product_policy import build_runtime_etf_product_policy
2020
from hk_equity_strategies.runtime_market_data_policy import build_runtime_market_data_policy
2121
from hk_equity_strategies.catalog import (
22+
HK_EQUITY_COMBO_PROFILE,
2223
HK_EQUITY_DOMAIN,
2324
HK_GLOBAL_ETF_TACTICAL_ROTATION_PROFILE,
2425
HK_LOW_VOL_DIVIDEND_QUALITY_SNAPSHOT_PROFILE,
@@ -185,6 +186,15 @@ def get_required_live_evidence_fields(profile: str) -> tuple[str, ...]:
185186
"min_required_oos_fold_count": MIN_REQUIRED_OOS_FOLD_COUNT,
186187
"max_single_period_return_contribution": MAX_SINGLE_PERIOD_RETURN_CONTRIBUTION,
187188
},
189+
HK_EQUITY_COMBO_PROFILE: {
190+
"max_allowed_backtest_drawdown": 0.30,
191+
"min_required_return_to_drawdown_ratio": 0.50,
192+
"max_allowed_annualized_turnover": 1.50,
193+
"min_required_annual_return": 0.0,
194+
"min_required_walk_forward_years": MIN_REQUIRED_WALK_FORWARD_YEARS,
195+
"min_required_oos_fold_count": MIN_REQUIRED_OOS_FOLD_COUNT,
196+
"max_single_period_return_contribution": MAX_SINGLE_PERIOD_RETURN_CONTRIBUTION,
197+
},
188198
}
189199

190200
PROFILE_LIVE_OPTIMIZATION_CHECKS: dict[str, tuple[str, ...]] = {

tests/test_catalog.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from hk_equity_strategies import get_strategy_definitions
88
from hk_equity_strategies.catalog import (
9+
HK_EQUITY_COMBO_PROFILE,
910
HK_EQUITY_DOMAIN,
1011
HK_GLOBAL_ETF_TACTICAL_ROTATION_PROFILE,
1112
HK_LOW_VOL_DIVIDEND_QUALITY_SNAPSHOT_PROFILE,
@@ -25,6 +26,7 @@
2526
def test_catalog_declares_runtime_enabled_hk_direct_strategies():
2627
catalog = get_strategy_definitions()
2728
assert set(catalog) == {
29+
HK_EQUITY_COMBO_PROFILE,
2830
HK_GLOBAL_ETF_TACTICAL_ROTATION_PROFILE,
2931
HK_LOW_VOL_DIVIDEND_QUALITY_SNAPSHOT_PROFILE,
3032
}
@@ -67,6 +69,7 @@ def test_profile_groups_keep_runtime_research_and_snapshot_scaffolds_separate():
6769
assert get_research_backtest_only_profiles() == frozenset()
6870
assert get_runtime_enabled_profiles() == frozenset(
6971
{
72+
HK_EQUITY_COMBO_PROFILE,
7073
HK_GLOBAL_ETF_TACTICAL_ROTATION_PROFILE,
7174
HK_LOW_VOL_DIVIDEND_QUALITY_SNAPSHOT_PROFILE,
7275
}

tests/test_live_enablement_matrix.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pytest
99

1010
from hk_equity_strategies.catalog import (
11+
HK_EQUITY_COMBO_PROFILE,
1112
HK_GLOBAL_ETF_TACTICAL_ROTATION_PROFILE,
1213
HK_LOW_VOL_DIVIDEND_QUALITY_SNAPSHOT_PROFILE,
1314
get_external_snapshot_scaffold_profiles,
@@ -40,8 +41,8 @@ def test_live_enablement_matrix_keeps_only_runtime_profiles_selectable_or_listed
4041
matrix = build_live_enablement_matrix()
4142

4243
assert set(matrix["selectable_profiles"]) == get_runtime_enabled_profiles()
43-
assert matrix["selectable_profile_count"] == 2
44-
assert matrix["profile_count"] == 2
44+
assert matrix["selectable_profile_count"] == 3
45+
assert matrix["profile_count"] == 3
4546
assert matrix["blocked_profile_count"] == 0
4647
assert get_external_snapshot_scaffold_profiles() == frozenset()
4748
assert get_research_backtest_only_profiles() == frozenset()
@@ -140,6 +141,6 @@ def test_print_hk_live_enablement_matrix_json():
140141
completed = subprocess.run([sys.executable, str(SCRIPT), "--json"], check=True, capture_output=True, text=True)
141142
payload = json.loads(completed.stdout)
142143

143-
assert payload["profile_count"] == 2
144+
assert payload["profile_count"] == 3
144145
assert payload["blocked_profile_count"] == 0
145146
assert set(payload["selectable_profiles"]) == get_runtime_enabled_profiles()

0 commit comments

Comments
 (0)