feat: persist feature research and versioned alpha assessments
This commit is contained in:
@@ -75,6 +75,10 @@ class FeatureSpec(Contract):
|
||||
template: TemplateSpec | None = None
|
||||
|
||||
|
||||
class FeatureConversion(Contract):
|
||||
version: int = Field(ge=1)
|
||||
|
||||
|
||||
class ViewSpec(Contract):
|
||||
name: str = Field(min_length=1, max_length=200)
|
||||
filters: dict = Field(default_factory=dict)
|
||||
@@ -85,8 +89,7 @@ class ViewSpec(Contract):
|
||||
def valid_filters(cls, value):
|
||||
from ..schemas import AlphaFilters
|
||||
|
||||
AlphaFilters.model_validate(value)
|
||||
return value
|
||||
return AlphaFilters.model_validate(value).model_dump(mode="json", exclude_none=True)
|
||||
|
||||
|
||||
class AssetWrite(Contract):
|
||||
@@ -151,6 +154,8 @@ class EvaluateInput(Contract):
|
||||
|
||||
@model_validator(mode="after")
|
||||
def target(self):
|
||||
if self.alpha_id and self.experiment_id:
|
||||
raise ValueError("实验评估应选择关联回测运行;Alpha 评估单独保存")
|
||||
if bool(self.alpha_id) == bool(self.backtest_run_id):
|
||||
raise ValueError("选择 Alpha 或回测运行之一")
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user