接通真实昨收成交额并前置校验表达式字段

This commit is contained in:
boris
2026-09-09 11:33:58 +08:00
parent 588da4958f
commit 30e8227099
2 changed files with 101 additions and 1 deletions
+21
View File
@@ -11,6 +11,27 @@ use ta_lib::{
pub const CONTRACT: &str = "fidc_factor_event_expression_v1";
pub const TA_REV: &str = "dd5a90259a3f9e04e2da9f38bf0719a841b40108";
pub fn field_dependencies(expr: &Expr) -> std::collections::BTreeSet<String> {
let mut fields = std::collections::BTreeSet::new();
match expr {
Expr::Field { name } => {
fields.insert(name.clone());
}
Expr::Indicator { inputs, .. } => {
for e in inputs {
fields.extend(field_dependencies(e));
}
}
Expr::Operator { args, .. } => {
for e in args {
fields.extend(field_dependencies(e));
}
}
_ => {}
}
fields
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
pub enum Expr {