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: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
14 changes: 13 additions & 1 deletion src/crypto_strategies/__init__.py
Original file line number Diff line number Diff line change
@@ -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",
]
45 changes: 38 additions & 7 deletions src/crypto_strategies/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 "<none>"
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)