-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrategy_loader.py
More file actions
36 lines (28 loc) · 1.26 KB
/
strategy_loader.py
File metadata and controls
36 lines (28 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from __future__ import annotations
from quant_platform_kit.common.strategies import (
StrategyDefinition,
load_strategy_entrypoint,
)
from quant_platform_kit.strategy_contracts import StrategyEntrypoint, StrategyRuntimeAdapter
from us_equity_strategies import get_platform_runtime_adapter
from strategy_registry import LONGBRIDGE_PLATFORM, resolve_strategy_definition
def load_strategy_definition(raw_profile: str | None) -> StrategyDefinition:
return resolve_strategy_definition(
raw_profile,
platform_id=LONGBRIDGE_PLATFORM,
)
def load_strategy_entrypoint_for_profile(raw_profile: str | None) -> StrategyEntrypoint:
definition = load_strategy_definition(raw_profile)
runtime_adapter = load_strategy_runtime_adapter_for_profile(raw_profile)
return load_strategy_entrypoint(
definition,
platform_id=LONGBRIDGE_PLATFORM,
available_inputs=runtime_adapter.available_inputs,
available_capabilities=runtime_adapter.available_capabilities,
)
def load_strategy_runtime_adapter_for_profile(raw_profile: str | None) -> StrategyRuntimeAdapter:
definition = load_strategy_definition(raw_profile)
return get_platform_runtime_adapter(
definition.profile,
platform_id=LONGBRIDGE_PLATFORM,
)