Operators

杰瑞发布于2025-10-15

These are all the operators:
  1. sign n. 符号;记号;迹象;手势
  2. regression n. 逆行;退化;回归;复原
  3. neutralize vt. 抵销;使…中和;使…无效;使…中立
  4. inverse n. 倒转;相反
  5. glossary n. 术语(特殊用语)表;词汇表;专业词典
  6. geometric[ˌdʒiəˈmetrɪk] adj. 几何学图形的;几何学的
abs(x):
Absolute value of x.
add(x, y, filter = false), x + y:
Add all inputs (at least 2 inputs required). If filter = true, filter all input NaN to 0 before adding.
densify(x):
This operator converts a grouping field with many buckets into a lesser number of only the available buckets, making working with grouping fields computationally efficient. The example below will clarify the implementation. Example: Say a grouping field is provided as an integer (e.g., industry: tech -> 0, airspace -> 1, ...) and for a certain date, we have instruments with grouping field values among {0, 1, 2, 99}. Instead of creating 100 buckets and keeping 96 of them empty, it is better to just create 4 buckets with values {0, 1, 2, 3}. So, if the number of unique values in x is n, densify maps those values between 0 and (n-1). The order of magnitude need not be preserved.
此运算符将具有许多桶的分组字段转换为只有较少数量的可用桶,从而提高了分组字段的计算效率。下面的例子将阐明实施。示例:假设分组字段以整数形式提供(例如,行业:技术->0,空域->1,…),对于某个日期,我们有分组字段值在{0,1,2,99}之间的仪器。与其创建100个桶并保持其中96个为空,不如只创建4个值为{0,1,2,3}的桶。因此,如果x中唯一值的数量为n,则将这些值映射到0和(n-1)之间。数量级不需要保留。
divide(x, y), x / y:
x/y
1/x:
inverse(x)
log(x):
Natural logarithm. For example: Log(high/low) uses natural logarithm of high/low ratio as stock weights.
自然对数。例如:Log(高/低)使用高/低比率的自然对数作为股票权重。
max(x, y, ..):
Maximum value of all inputs. At least 2 inputs are required; max (close, vwap)
min(x, y ..):
Minimum value of all inputs. At least 2 inputs are required;min(close, vwap)
multiply(x ,y, ... , filter=false), x * y:
Multiply all inputs. At least 2 inputs are required. Filter sets the NaN values to 1;multiply(rank(-returns), rank(volume/adv20), filter=true)
power(x, y):
x ^ y ; power (returns, volume/adv20); power (returns, volume/adv20, precise=true); power (x, y) operator can be used to implement popular mathematical functions. For example, sigmoid(close) can be implemented using power(x) as: 1/(1+ power(2.7182, -close)
reverse(x):
- x
sign(x):
if input > 0, return 1; if input < 0, return -1; if input = 0, return 0; if input = NaN, return NaN;
signed_power(x, y):
x raised to the power of y such that final result preserves sign of x; sign(x) * (abs(x) ^ y) x raised to the power of y such that final result preserves sign of x. For power of 2, x ^ y will be a parabola but signed_power(x, y) will be odd and one-to-one function (unique value of x for certain value of signed_power(x, y)) unlike parabola. Example: If x = 3, y = 2 ⇒ abs(x) = 3 ⇒ abs(x) ^ y = 9 and sign(x) = +1 ⇒ sign(x) * (abs(x) ^ y) = signed_power(x, y) = 9; If x = -9, y = 0.5 ⇒ abs(x) = 9 ⇒ abs(x) ^ y = 3 and sign(x) = -1 ⇒ sign(x) * (abs(x) ^ y) = signed_power(x, y)
sqrt(x):
Square root of x
subtract(x, y, filter=false), x - y:
x-y. If filter = true, filter all input NaN to 0 before subtracting
and(input1, input2):
Logical AND operator, returns true if both operands are true and returns false otherwise
if_else(input1, input2, input 3):
If input1 is true then return input2 else return input3.
input1 < input2:
If input1 < input2 return true, else return false
input1 <= input2:
Returns true if input1 <= input2, return false otherwise
input1 == input2:
Returns true if both inputs are same and returns false otherwise
input1 > input2:
Logic comparison operators to compares two inputs
input1 >= input2:
Returns true if input1 >= input2, return false otherwise
input1!= input2:
Returns true if both inputs are NOT the same and returns false otherwise
is_nan(input):
If (input == NaN) return 1 else return 0
not(x):
Returns the logical negation of x. If x is true (1), it returns false (0), and if input is false (0), it returns true (1).