Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
236 views
in Technique[技术] by (71.8m points)

DolphinDB ploop函数的用法

Usage: ploop(func, args...). The length of all args must be consistent.

def piep(c,mutable data_dhz){
 Future_s=select last(askPrice1) as askPrice1,last(bidPrice1) as bidPrice1 from Future_source where product=`j
 Trading_t=select * from Trading_Table
 configs=select * from trad_model_config where strategy=`DHZ,hide>0,state>0
 Func_DHZ(c,configs,data_dhz,Trading_t,Future_s)
 }
 
def DHZ(mutable ss,msg){
 data_dhz=select last(product) as symbol,last(time) as time,first(price_index) as open,max(price_index) as high,min(price_index) as low,last(price_index) as close,last(price_index) as askPrice1,last(price_index) as bidPrice1 from future_index where product =`j group by tradingDay,time.minute()  
 configs=select * from trad_model_config where strategy=`DHZ,hide>0,state>0
 
 conf=[]
 for (c in 0..(size(configs)-1)){
  conf.append!(c)
  }
 ploop(piep,conf,data_dhz)

}

上述代码,在执行时报错:msgId=32223644 length=400 exception=Usage: ploop(func, args...). The length of all args must be consistent.
这里有方法改成参数数量不一致也能运行吗?
我的需求是固定data_dhz,而conf是多个,即输入ploop(piep,[1,2,3,4],data_dhz),达到ploop(piep,[1,2,3,4],[data_dhz,data_dhz,data_dhz,data_dhz])的效果。谢谢!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

这里可使用DolphinDB database的部分应用实现。部分应用是指固定一个函数的部分参数,产生一个参数较少的函数。

ploop(piep{,data_dhz},conf)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.7k users

...