这里可使用DolphinDB database的部分应用实现。部分应用是指固定一个函数的部分参数,产生一个参数较少的函数。
ploop(piep{,data_dhz},conf)
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])的效果。谢谢!