![](/img/trans.png)
[英]DolphinDB error: A metric shouldn't be a constant in reactive state engine
[英]DolphinDB reactive state engine: Calculate the metrics of the last 10 records in a column
當使用反應式 state 引擎處理 stream 數據時,我想計算最后十行中有多少行與當前行具有相同的值。 有什么辦法嗎?
您可以將用戶定義的 function 與moving
function 結合使用。
(1)定義一個聚合function
defg ncount(x){
return sum(x == x.tail())
}
(2) Function ncount() 在 function moving
中定義。
它用作參數mertic中的公式。
metrics =[<time>, <moving(ncount, price, 10)>]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.