陈无忌
陈无忌

性别: 注册于 2023-04-17

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

7 个回答

0 赞同

计算rps排名

您好,DolphinDB 通过提供 context by 的 SQL 语句的方式,为时序数据高效便捷加工提供了方便的工具。通过 context by tradeDate + rank 函数的方式,我们可以快捷地计算个股在当日涨幅强度的排行榜。 实现代码如下: update t set rps = rank(pct_ret) context by tradeDate 完整代码如下: def genDayKData(startDate...

回答于 2023-12-23 16:05

1 赞同

关于财务数据的建库问题

您好,方案二查询性能下降的问题可以通过设置 sortKeyMappingFunction 解决。 当使用 TSDB 引擎对 sortColumn 设置多列时,除最后一列外的其余列称为 sort key,未优化的 sortColumn 设置会导致 sort key 过多,引发压缩比降低、查询性能不佳等负面效果。例如 sortColumn 为 id, quarter, info_date, fields 时,sort key...

回答于 2023-12-23 15:40

0 赞同

python 日期字符串与 dolphinDB 日期的转换

// https://ask.dolphindb.net/question/3432 // python 日期字符串与 dolphinDB 日期的转换 // For one date string testDate = "2019-01-01" temporalParse(testDate, "yyyy-MM-dd") // For a list of date strings testDateList = ["2019-01-01", "2019-01-02", "2019-01-03"] temporalParse(testDateList, "yyyy-MM-dd...

回答于 2023-08-09 10:22

0 赞同

getDFSDatabases()函数可以搜索特定名字的数据库吗?

wantedDbName = 'YOUR WANTED DATABASE NAME' select * from table(getDFSDatabases() as `dbName) where dbName = wantedDbName // 查询以 dfs://WIND 作为开头的所有数据库 select * from table(getDFSDatabases() as `dbName) where dbName like "dfs://WIND%" 提供了两种情况的示例,希望能对您的问题有所帮助~ `getD...

回答于 2023-06-01 09:19

0 赞同

请问类似pandas的df.shift()在dolphindb中如何实现

date = 2023.01.01..2023.01.08; price=2.1 2.2 2.3 2.5 2.6 2.8 2.7 2.5; volume=10 20 10 40 10 40 10 20; a = table(date,price,volume) // 等同于 df.sort_values(by='date', ascending=True, inplace=True) a.sortBy!(`date, sortDirections=1)   // 使用move计算收益率 a['ret'] = a.price / a.price.move(1) - 1...

回答于 2023-06-01 08:57

0 赞同

mwavg函数中进行窗口内的last操作

实现方式: price=2.1 2.2 2.3 2.5 2.6 2.8 2.7 2.5; volume=10 20 10 40 10 40 10 20; a = table(price,volume) windowLength = 3 select *, mwavg(iif(price>mlast(price, windowLength), price, 0), volume, windowLength, 1) from a     输出结果: 对窗口聚合计算,DolphinDB提供了形如 mfirst mlast 等 m*...

回答于 2023-05-31 17:58

0 赞同

如何改变表中某一列的数据类型

可参考:// 先将vol列转换为double类型normalPanelData.replaceColumn!(`vol, double(normalPanelData.vol))// 或者normalPanelData.replaceColumn!(`vol, normalPanelData.vol $ DOUBLE)

回答于 2023-05-16 10:59