filter参数只能是一个表达式。设置多个条件时,用逻辑运算符(and, or)连接。
参考如下代码
def sum_diff(x, y){ return (x-y)/(x+y) } factor1 = <ema(1000 * sum_diff(ema(price, 20), ema(price, 40)),10) - ema(1000 * sum_diff(ema(price, 20), ema(price, 40)), 20)> share streamTable(1:0, `sym`time`price, [STRING,DATETIME,DOUBLE]) as tickStream result = table(1000:0, `sym`time`factor1, [STRING,DATETIME,DOUBLE]) rse = createReactiveStateEngine(name="reactiveDemo", metrics =[<time>, factor1], dummyTable=tickStream, outputTable=result, keyColumn="sym", filter=<sym in ["000001.SH", "000002.SH"] and price > 0>) subscribeTable(tableName=`tickStream, actionName="factors", handler=tableInsert{rse}) data1 = table(take("000001.SH", 100) as sym, 2021.02.08T09:30:00 + 1..100 *3 as time, 10+cumsum(rand(0.1, 100)-0.05)as price) data2 = table(take("000002.SH", 100) as sym, 2021.02.08T09:30:00 + 1..100 *3 as time, 20+cumsum(rand(0.2, 100)-0.1)as price) data3 = table(take("000003.SH", 100) as sym, 2021.02.08T09:30:00 + 1..100 *3 as time, 30+cumsum(rand(0.3, 100)-0.15)as price) data = data1.unionAll(data2).unionAll(data3).sortBy!(`time) replay(inputTables=data, outputTables=tickStream, timeColumn=`time)
具体使用可以参考用户手册中有关filter参数的说明:https://www.dolphindb.cn/cn/help/FunctionsandCommands/FunctionReferences/c/createReactiveStateEngine.html