ratios函数,对应问题中的python实现逻辑可以这样实现:
price = 3 12 0 -5 32; res = ratios(price) - 1;
具体用法见手册:https://www.dolphindb.cn/cn/help/FunctionsandCommands/FunctionReferences/r/ratios.html
在python中可以配合shift实现
data['last_price'] = data['price'].shift(1) res = (data['price'] / data['last_price'] - 1)
ratios函数,对应问题中的python实现逻辑可以这样实现:
price = 3 12 0 -5 32; res = ratios(price) - 1;
具体用法见手册:https://www.dolphindb.cn/cn/help/FunctionsandCommands/FunctionReferences/r/ratios.html