接通真实昨收成交额并前置校验表达式字段
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user