Shena Mao
Shena Mao

性别: 注册于 2021-07-23

向TA求助
20金币数
640 经验值
1个粉丝
主页被访问 2521 次

46 个回答

0 赞同

dolphin python api下时间字段的空值问题

你好,从 1.30.19.1 版本开始,Python API 在上传包含空值组合、空值与非空值组合的数组(包括 List, numpy.array)时,对数组类型的判断统一了处理规范,具体规范请查看:https://gitee.com/dolphindb/api_python3#13-dolphindb-%E7%A9%BA%E5%80%BC%E5%A4%84%E7%90%86%E8%A7%84%E5%88%99 如果方便的话,可以提供一下之前...

回答于 2022-09-26 10:20

0 赞同

分钟级因子存储为宽表如何为何

你好,很高兴你这边有深入了解因子实践,针对你这边问的几个,DolphinDB这边都可以解决: 1. 可以直接添加股票。只是如果添加股票之后,导入的时候需要使用新的数据结构。在写入数据之后,不能按照以前的数据结构append。 2. 对应的空值可以写空值的,你这边报错的话报具体说明错误呢? 3. 比较建议对于一个因子而言,所...

回答于 2022-07-04 18:46

0 赞同

如何用split对表中的一列操作,使其每一个元素为一列呢?

由于split的对象必须是标量,故在表中,可以用each\loop进行操作。 可以写一个自定义函数,将其应用于想要展开的几列: def splitV(sp,k){        return string(split(sp, " ")[k])} 应用于表中: sp = array(STRING, 0).append!("aa bb cc").append!("aa bb dd")t = table(sp as sp)select *, each(splitV,sp,0) as...

回答于 2022-06-13 16:36

0 赞同

请教一下,日度K线表,如果我想每天计算最近5天所有 开、高、低...

这边可以将公式拆分,写一个自定义函数,即可高效算出均值和标准差。 def std_ohlc(open, close, high, low){ count = mcount(close,5)+mcount(open,5)+mcount(high,5)+mcount(low,5) avg = (msum(close, 5)+msum(open, 5)+msum(low, 5)+msum(high, 5))\count sum2 = msum(close*close, 5)+msum(open*open, 5)+msum(hig...

回答于 2022-06-13 10:46

0 赞同

如何根据离散分布采样?

可以用自定义函数解决这个问题: def choice(v, n, p){        cump = removeTail!([0.0].join(cumsum(p\p.sum())), 1)        return v[cump.asof(rand(1.0, n))]}a=[1, 2, 3, 4]n=100000p=[0.1, 0.1, 0.3, 0.5]r = choice(a, n, p) 在1.30.19\2.00.7版本以后,可以调用函数randDiscrete randDiscrete(1 2 3 4, [0.1,...

回答于 2022-06-13 10:24

0 赞同

如何实现滑动窗口ols取r2值?

这个计算的难点在于,moving函数需要聚合,而ols不是聚合函数;each的参数不能如moving函数这样传参。 故在写的时候,需要先将ols取r2的值进行封装,使其为自定义聚合函数。 再将moving函数封装,最后each调用。 具体可以参考以下: defg getR2(x,y){        return ols(x,y,,2).RegressionStat[0,1]        }def movin...

回答于 2022-05-26 17:34

0 赞同

如何对数据根据股票做采样?每个股票都需要100个样本,保证顺序...

可以用context by针对品种分组,然后用having,对每一个组内的数据用rowNo()函数进行过滤输出。 例子如下,对一组数据根据id的种类每组采样20个样本: a = table(rand(`a`b`c,2000) as id, rand(50.0,2000) as price,1..2000 as rowno)select * from a context by id having rowNo(id) in (0 join (rowNo(id).max()/18*1....

回答于 2022-04-21 17:47

1 赞同

python parser 如何执行脚本语言中的函数或命令?

目前,python parse中python相关的,是对象.方法() 在python parse 中也可以执行dolphindb 的内置函数,是方法()。

回答于 2022-04-20 15:01

0 赞同

apply ema & similar function on array vector

refer to https://ask.dolphindb.net/question/1157 array Vector in reactiveStateEngine will supported by next version. However, adding the function of calculating msum among array vector is not part of the plan of next version. It may be realized at least after next version.

回答于 2022-02-10 12:26

0 赞同

using reactiveStateEngine generate array

In SQL, you could use fixedLengthArrayVector function to do this. t1 = table(take(2020.01.01,18) as date1,1 2 3 1 2 3 4 4 5 5 6 7 8 9 6 7 8 9 as index, `A`A`A`B`B`B`A`B`B`A`A`A`A`A`B`B`B`B as symbol, 4 7 1 8 7 4 5 7 4 8 7 6 9 8 7 5 4 1 as value)t2= select index, symbol, value,fixedLengthArrayVector...

回答于 2022-02-08 18:05