diff --git a/pyproject.toml b/pyproject.toml index 3e6712a..3a49f82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "Shared crypto strategy catalog and implementations" readme = "README.md" requires-python = ">=3.11" dependencies = [ - "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@v0.6.0", + "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@6e8cc058b821aea8a54015d4b39e02fbdd3dc198", ] [tool.setuptools] diff --git a/src/crypto_strategies/__init__.py b/src/crypto_strategies/__init__.py index 51f3077..b4a3a12 100644 --- a/src/crypto_strategies/__init__.py +++ b/src/crypto_strategies/__init__.py @@ -1,7 +1,19 @@ -from .catalog import STRATEGY_DEFINITIONS, get_strategy_definition, get_strategy_definitions +from .catalog import ( + STRATEGY_CATALOG, + STRATEGY_DEFINITIONS, + get_strategy_catalog, + get_strategy_definition, + get_strategy_definitions, + get_strategy_index_rows, + get_strategy_metadata, +) __all__ = [ + "STRATEGY_CATALOG", "STRATEGY_DEFINITIONS", + "get_strategy_catalog", "get_strategy_definition", "get_strategy_definitions", + "get_strategy_index_rows", + "get_strategy_metadata", ] diff --git a/src/crypto_strategies/catalog.py b/src/crypto_strategies/catalog.py index 8b4c411..a85492b 100644 --- a/src/crypto_strategies/catalog.py +++ b/src/crypto_strategies/catalog.py @@ -2,8 +2,14 @@ from quant_platform_kit.common.strategies import ( CRYPTO_DOMAIN, + StrategyCatalog, StrategyComponentDefinition, StrategyDefinition, + StrategyMetadata, + build_strategy_catalog, + build_strategy_index_rows, + get_catalog_strategy_definition, + get_catalog_strategy_metadata, ) CRYPTO_LEADER_ROTATION_PROFILE = "crypto_leader_rotation" @@ -26,16 +32,41 @@ ), } +STRATEGY_METADATA: dict[str, StrategyMetadata] = { + CRYPTO_LEADER_ROTATION_PROFILE: StrategyMetadata( + canonical_profile=CRYPTO_LEADER_ROTATION_PROFILE, + display_name="Crypto Leader Rotation", + description="Trend-following crypto rotation with staged entries, degradation controls, and cash parking.", + aliases=(), + cadence="daily", + asset_scope="liquid_crypto_assets", + benchmark="BTC", + role="crypto_offensive_rotation", + status="runtime_enabled", + ), +} + +STRATEGY_CATALOG: StrategyCatalog = build_strategy_catalog( + strategy_definitions=STRATEGY_DEFINITIONS, + metadata=STRATEGY_METADATA, +) + def get_strategy_definitions() -> dict[str, StrategyDefinition]: return dict(STRATEGY_DEFINITIONS) +def get_strategy_catalog() -> StrategyCatalog: + return STRATEGY_CATALOG + + def get_strategy_definition(profile: str) -> StrategyDefinition: - normalized = str(profile or "").strip().lower() - if normalized not in STRATEGY_DEFINITIONS: - supported = ", ".join(sorted(STRATEGY_DEFINITIONS)) or "" - raise ValueError( - f"Unknown crypto strategy profile={profile!r}; supported values: {supported}" - ) - return STRATEGY_DEFINITIONS[normalized] + return get_catalog_strategy_definition(STRATEGY_CATALOG, profile) + + +def get_strategy_metadata(profile: str) -> StrategyMetadata: + return get_catalog_strategy_metadata(STRATEGY_CATALOG, profile) + + +def get_strategy_index_rows() -> list[dict[str, object]]: + return build_strategy_index_rows(STRATEGY_CATALOG)