-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstrategy_loader.py
More file actions
41 lines (33 loc) · 1.37 KB
/
Copy pathstrategy_loader.py
File metadata and controls
41 lines (33 loc) · 1.37 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
37
38
39
40
41
from __future__ import annotations
from quant_platform_kit.common.platform_runner.loader import (
load_strategy_definition as _qpk_load_definition,
load_strategy_entrypoint_for_profile as _qpk_load_entrypoint,
)
from quant_platform_kit.common.strategies import StrategyDefinition
from quant_platform_kit.common.strategy_contracts import (
StrategyEntrypoint,
StrategyRuntimeAdapter,
)
from strategy_registry import FIRSTRADE_PLATFORM as PLATFORM, PLATFORM_POLICY, STRATEGY_CATALOG, get_platform_runtime_adapter
def load_strategy_definition(raw_profile: str | None) -> StrategyDefinition:
return _qpk_load_definition(
raw_profile,
platform_id=PLATFORM,
strategy_catalog=STRATEGY_CATALOG,
policy=PLATFORM_POLICY,
)
def load_strategy_entrypoint_for_profile(raw_profile: str | None) -> StrategyEntrypoint:
runtime_adapter = load_strategy_runtime_adapter_for_profile(raw_profile)
return _qpk_load_entrypoint(
raw_profile,
platform_id=PLATFORM,
strategy_catalog=STRATEGY_CATALOG,
policy=PLATFORM_POLICY,
runtime_adapter=runtime_adapter,
)
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=PLATFORM,
)