pct_change 等价于 (x(n) - x(n-1))/x(n-1) 即 x(n) / x(n-1) - 1, 可以用 DolphinDB 的函数 ratios 计算。上述 Python 代码等价于 DDB 脚本:
def calc(x){
y = ratios(x) - 1
return mstd(y, 3, 2)
}
calc(x)
在python中,计算250天股价波动方差的程序如下:
data.get("close").pct_change().rolling(250,min_periods=100).std()
请教一下,在dolphindb中,用哪个窗口命令是等效的?