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
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
flask
gunicorn
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@v0.6.0
us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@17fa78c22463070b88ba4a884c84e7a761835ccb
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@6e8cc058b821aea8a54015d4b39e02fbdd3dc198
us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@8b0c59f2ecd7c74cc2d350f1870f124a2560b205
pandas
requests
pytz
Expand Down
36 changes: 18 additions & 18 deletions strategy_registry.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from __future__ import annotations

from us_equity_strategies.platform_registry_support import (
from us_equity_strategies import get_strategy_catalog

from quant_platform_kit.common.strategies import (
PlatformStrategyPolicy,
StrategyDefinition,
US_EQUITY_DOMAIN,
build_platform_profile_matrix,
get_enabled_profiles_for_platform,
resolve_platform_strategy_definition,
)

from quant_platform_kit.common.strategies import StrategyDefinition, US_EQUITY_DOMAIN

LONGBRIDGE_PLATFORM = "longbridge"

DEFAULT_STRATEGY_PROFILE = "semiconductor_rotation_income"
Expand All @@ -18,25 +21,24 @@
PLATFORM_SUPPORTED_DOMAINS: dict[str, frozenset[str]] = {
LONGBRIDGE_PLATFORM: frozenset({US_EQUITY_DOMAIN}),
}
STRATEGY_CATALOG = get_strategy_catalog()
PLATFORM_POLICY = PlatformStrategyPolicy(
platform_id=LONGBRIDGE_PLATFORM,
supported_domains=PLATFORM_SUPPORTED_DOMAINS[LONGBRIDGE_PLATFORM],
enabled_profiles=LONGBRIDGE_ENABLED_PROFILES,
default_profile=DEFAULT_STRATEGY_PROFILE,
rollback_profile=ROLLBACK_STRATEGY_PROFILE,
)

SUPPORTED_STRATEGY_PROFILES = LONGBRIDGE_ENABLED_PROFILES


def get_supported_profiles_for_platform(platform_id: str) -> frozenset[str]:
return get_enabled_profiles_for_platform(
platform_id,
expected_platform_id=LONGBRIDGE_PLATFORM,
enabled_profiles=LONGBRIDGE_ENABLED_PROFILES,
)
return get_enabled_profiles_for_platform(platform_id, policy=PLATFORM_POLICY)


def get_platform_profile_matrix() -> list[dict[str, object]]:
return build_platform_profile_matrix(
platform_id=LONGBRIDGE_PLATFORM,
enabled_profiles=LONGBRIDGE_ENABLED_PROFILES,
default_profile=DEFAULT_STRATEGY_PROFILE,
rollback_profile=ROLLBACK_STRATEGY_PROFILE,
)
return build_platform_profile_matrix(STRATEGY_CATALOG, policy=PLATFORM_POLICY)


def resolve_strategy_definition(
Expand All @@ -47,8 +49,6 @@ def resolve_strategy_definition(
return resolve_platform_strategy_definition(
raw_value,
platform_id=platform_id,
expected_platform_id=LONGBRIDGE_PLATFORM,
enabled_profiles=LONGBRIDGE_ENABLED_PROFILES,
platform_supported_domains=PLATFORM_SUPPORTED_DOMAINS,
default_profile=DEFAULT_STRATEGY_PROFILE,
strategy_catalog=STRATEGY_CATALOG,
policy=PLATFORM_POLICY,
)