|
2 | 2 |
|
3 | 3 | from quant_platform_kit.common.strategies import ( |
4 | 4 | CRYPTO_DOMAIN, |
| 5 | + StrategyCatalog, |
5 | 6 | StrategyComponentDefinition, |
6 | 7 | StrategyDefinition, |
| 8 | + StrategyMetadata, |
| 9 | + build_strategy_catalog, |
| 10 | + build_strategy_index_rows, |
| 11 | + get_catalog_strategy_definition, |
| 12 | + get_catalog_strategy_metadata, |
7 | 13 | ) |
8 | 14 |
|
9 | 15 | CRYPTO_LEADER_ROTATION_PROFILE = "crypto_leader_rotation" |
|
26 | 32 | ), |
27 | 33 | } |
28 | 34 |
|
| 35 | +STRATEGY_METADATA: dict[str, StrategyMetadata] = { |
| 36 | + CRYPTO_LEADER_ROTATION_PROFILE: StrategyMetadata( |
| 37 | + canonical_profile=CRYPTO_LEADER_ROTATION_PROFILE, |
| 38 | + display_name="Crypto Leader Rotation", |
| 39 | + description="Trend-following crypto rotation with staged entries, degradation controls, and cash parking.", |
| 40 | + aliases=(), |
| 41 | + cadence="daily", |
| 42 | + asset_scope="liquid_crypto_assets", |
| 43 | + benchmark="BTC", |
| 44 | + role="crypto_offensive_rotation", |
| 45 | + status="runtime_enabled", |
| 46 | + ), |
| 47 | +} |
| 48 | + |
| 49 | +STRATEGY_CATALOG: StrategyCatalog = build_strategy_catalog( |
| 50 | + strategy_definitions=STRATEGY_DEFINITIONS, |
| 51 | + metadata=STRATEGY_METADATA, |
| 52 | +) |
| 53 | + |
29 | 54 |
|
30 | 55 | def get_strategy_definitions() -> dict[str, StrategyDefinition]: |
31 | 56 | return dict(STRATEGY_DEFINITIONS) |
32 | 57 |
|
33 | 58 |
|
| 59 | +def get_strategy_catalog() -> StrategyCatalog: |
| 60 | + return STRATEGY_CATALOG |
| 61 | + |
| 62 | + |
34 | 63 | def get_strategy_definition(profile: str) -> StrategyDefinition: |
35 | | - normalized = str(profile or "").strip().lower() |
36 | | - if normalized not in STRATEGY_DEFINITIONS: |
37 | | - supported = ", ".join(sorted(STRATEGY_DEFINITIONS)) or "<none>" |
38 | | - raise ValueError( |
39 | | - f"Unknown crypto strategy profile={profile!r}; supported values: {supported}" |
40 | | - ) |
41 | | - return STRATEGY_DEFINITIONS[normalized] |
| 64 | + return get_catalog_strategy_definition(STRATEGY_CATALOG, profile) |
| 65 | + |
| 66 | + |
| 67 | +def get_strategy_metadata(profile: str) -> StrategyMetadata: |
| 68 | + return get_catalog_strategy_metadata(STRATEGY_CATALOG, profile) |
| 69 | + |
| 70 | + |
| 71 | +def get_strategy_index_rows() -> list[dict[str, object]]: |
| 72 | + return build_strategy_index_rows(STRATEGY_CATALOG) |
0 commit comments