Juntao Wang
Juntao Wang

性别: 注册于 2021-05-07

向TA求助
0金币数
2730 经验值
0个粉丝
主页被访问 2315 次

254 个回答

0 赞同

表转为矩阵,如何补全缺少的股票?

示例代码: t = table(2022.07.04T09:45:00 2022.07.04T09:45:00 2022.07.04T09:45:00 2022.07.04T09:45:00 as time, `A`B`C`D as sym, 1.0 2.0 3.0 4.0 as value) syms = `A`B`C`D`E`F symsTmp = syms[not syms in (exec sym from t)] insert into t(sym) values(symsTmp) select value from t pivot by time, sym

回答于 2022-07-13 12:01

0 赞同

如何方便地计算去年同期价格增长率?

示例代码: t = table(2022.07.04T00:00:00 2021.07.04T00:00:00 2022.07.04T00:00:00 2021.07.04T00:00:00 as time, `A`A`B`B as sym, 1.0 2.0 3.0 4.0 as openPrice) def groupByTime(time) { return substr(string(time), 5) } select time, sym, openPrice, ratios(openPrice) - 1 as ratios from t context by sym,...

回答于 2022-07-13 12:00

0 赞同

两个Vector A、B,如果获取存在于A不存在于B中的值?

示例代码如下: A = ["a", "b", "c", "d"] B = ["a", "b"] A[at(not A in B)]

回答于 2022-06-20 15:52

0 赞同

数据节点报错:Failed to connect to host = [] port = [] with...

无法建立连接,常见的原因:连接数满了。连接数查看方法参考:https://ask.dolphindb.net/question/1850

回答于 2022-06-17 16:47

0 赞同

Java API构造BasicDateVector / BasicTimeVector需要传入int列表...

示例如下: DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyyMMdd"); DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HHmmssSSS"); Utils.countDays(LocalDate.parse(currentDate, dateFormatter)) Utils.countMilliseconds(LocalTime.parse(String.format("%09d", Integer.parse...

回答于 2022-06-17 16:45

0 赞同

查询时报错:Both arguments for character comparison must hav...

更改为: // 方式1 select * from getTabletsMeta() where chunkId = uuid("92cc1df2-f748-6186-454a-43f33fd6c84f") // 方式2 select * from getTabletsMeta() where string(chunkId) = "92cc1df2-f748-6186-454a-43f33fd6c84f"

回答于 2022-06-17 16:44

0 赞同

分布式表更新不成功也未报错,会是什么原因?

分析了下,是大小写问题,更新语句改为 update loadTable("dfs://test", "test") set deviceId = 'MIX1', value = 55 where value = 44 可以成功,即deviceid 改为 deviceId 。 目前版本中,分布式更新时,严格区分大小写。后面我们会向开发建议支持不区分大小写,这样对用户更友好。

回答于 2022-06-17 16:42

0 赞同

多个因子如何拼成一张表?

我们推荐这样一种方式: 每个因子算完之后是个单值模型,类似下面截图数据格式: 所有因子append!到一张表,然后根据TradingTime、SecurityID、Factorname 字段做个pivot by, select Factorvalue from t pivot by TradingTime, SecurityID, Factorname 参考链接:DolphinDB 因子计算最佳实践白皮书

回答于 2022-06-17 16:34

0 赞同

如何将表导出为二进制文件?

可以使用writeRecord 函数,示例代码如下: n = 10000 t = table(rand(1..100, n) as id, rand(100.0, n) as value) f = file("/hdd/hdd0/jtwang/data/xinfei/test_export.bin", "w") writeRecord(f, t) 这个函数目前有些限制,对于字符串类型不支持,可以使用API 规避一下,Python API示例代码如下: binFile = open("D...

回答于 2022-06-11 22:06

0 赞同

针对某列,希望该列的值变化时,返回变化相应的两条记录,SQL如...

示例代码如下: t = table(0 0 0 1 1 1 0 0 as value, 2022.01.01 12:00:00 + 1..8 as time, take(1, 8) as id) select * from t where id = 1, (value != prev(value) and isValid(prev(value))) or (value != next(value) and isValid(next(value))) context by id

回答于 2022-06-11 22:01