簡體   English   中英

DolphinDB reactive state 引擎:計算某列最后10條記錄的指標

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM