mhxiang
mhxiang

性别: 注册于 2021-12-09

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

63 个回答

0 赞同

怎样按因子值排序之后分成多组

可以通过cutPoints函数和asof函数实现。如: sym=take(string(100000..100010),20) date=sort(take(2022.04.27..2022.04.28,20)) factor_value= 1..10 join take(int(),3) join 3..9 tb= table( sym, date, factor_value) select *,asof(cutPoints(int(factor_value*100000),3),factor_value*100000)+1 as factor_qu...

回答于 2022-09-22 17:55

0 赞同

是把factor_value作为Y, 其他列作为X,然后取他的计算残差再重新...

生成模拟数据:x1=1 3 5 7 11 16 23 1 3 5 7 11 16 23 x2=2 8 11 34 56 54 100 2 8 11 34 56 54 100 y=0.1 4.2 5.6 8.8 22.1 35.6 77.2 0.1 4.2 5.6 8.8 22.1 35.6 77.2; date=take(2022.01.01..2022.01.03,14) code=take(`600000`6000001`600002,14) clean_factor=table(date,code,y,x1 as `11,x2 as `12)可以直接通过元...

回答于 2022-09-13 10:30

0 赞同

有个问题请教一下,我想批量定义和预分配100张表,怎么写比较方...

list_tables=each(x->table(150000:0, `trade_day`secu_code`factor_value, `INT`INT`DOUBLE),1..100) list_tables[0]

回答于 2022-09-07 11:50

0 赞同

有什么快捷函数可以把第一张表扩展成第二张表吗,就是把start_no...

用each函数对原始表的每一行调用cj函数,对原始表的每一行数据生成的表和start_no与end_no生成的连续数据表执行交叉连接,然后用unionAll合并结果。 start_no=[565663,565918,566010,566363,566512] end_no=[565722,565983,566245,566487,566550] tb=table(take(2022.06.01,5) as date,take(`src55,5) as source,take(`S...

回答于 2022-09-06 17:50

0 赞同

想要对大数据集,分组后取percentile筛票统计,该如何写呢

用aggrTopN函数 tb=select *from loadText("/home/data.csv") tt=select aggrTopN(avg, funcArgs=yield, sortingCol=yield, top=0.4, ascending=true) as factor_value from tb group by trade_date,secu_code

回答于 2022-08-30 17:54

0 赞同

找过去60行最大close时候对应的score,怎么写sql

用mimax和rowNo a=table(rand(1.0,200) as close,rand(1.0,200) as score) r=select score[rowNo(close)-59+mimax(close,60)] from a

回答于 2022-08-29 14:23

1 赞同

full join 之后keyColums 会出现两列,合并两列的话有没有什么简...

t1= table(1 2 3 3 as id, 7.8 4.6 5.1 0.1 as value);t2 = table(5 3 1 as id,  300 500 800 as qty);select nullFill(id,t2.id) as id,value,qty from fj(t1, t2, `id)

回答于 2022-08-17 15:11

0 赞同

Incompatible vector/matrix size

请问你的版本是多少?我这边2.00.7和1.30.19版本没有问题 defg featureEngine(bidPrice,bidQty,offerPrice,offerQty){ bas = offerPrice[0]\bidPrice[0]-1 wap = (bidPrice[0]*offerQty[0] + offerPrice[0]*bidQty[0])\(bidQty[0]+offerQty[0]) di = (bidQty-offerQty)\(bidQty+offerQty) bidw=(1.0\(bidPrice-wap))...

回答于 2022-08-08 11:21

0 赞同

怎么求一列中的每个值向前找第二次变小的值?

data=[1,2,3,4,5,6,7,8,9,11,14,13,15,14,15,16,17] def f(a,i){ if(i<2)return int() ncount=0 for (k in sort(1..i,false)){ if(a[k]>a[k-1]){ ncount=ncount+1 } if(ncount>=2){ return a[k-1] } } return int() } each(f{data,},0..(size(data)-1))

回答于 2022-07-28 11:43

0 赞同

在py段接收DDB流表的信息时,可否把字典传过来?

subscribe的msgAsTable设置为True

回答于 2022-07-21 15:04