@@ -57,7 +57,7 @@ def __init__(
5757 fit_end_time = None ,
5858 filter_pipe = None ,
5959 inst_processor = None ,
60- ** kwargs ,
60+ ** kwargs
6161 ):
6262 infer_processors = check_transform_proc (infer_processors , fit_start_time , fit_end_time )
6363 learn_processors = check_transform_proc (learn_processors , fit_start_time , fit_end_time )
@@ -67,7 +67,7 @@ def __init__(
6767 "kwargs" : {
6868 "config" : {
6969 "feature" : self .get_feature_config (),
70- "label" : kwargs .get ("label" , self .get_label_config ()),
70+ "label" : kwargs .pop ("label" , self .get_label_config ()),
7171 },
7272 "filter_pipe" : filter_pipe ,
7373 "freq" : freq ,
@@ -82,12 +82,14 @@ def __init__(
8282 data_loader = data_loader ,
8383 learn_processors = learn_processors ,
8484 infer_processors = infer_processors ,
85+ ** kwargs
8586 )
8687
8788 def get_label_config (self ):
88- return ( ["Ref($close, -2)/Ref($close, -1) - 1" ], ["LABEL0" ])
89+ return ["Ref($close, -2)/Ref($close, -1) - 1" ], ["LABEL0" ]
8990
90- def get_feature_config (self ):
91+ @staticmethod
92+ def get_feature_config ():
9193 # NOTE:
9294 # Alpha360 tries to provide a dataset with original price data
9395 # the original price data includes the prices and volume in the last 60 days.
@@ -99,33 +101,33 @@ def get_feature_config(self):
99101 names = []
100102
101103 for i in range (59 , 0 , - 1 ):
102- fields += ["Ref($close, %d)/$close" % ( i ) ]
103- names += ["CLOSE%d" % ( i ) ]
104+ fields += ["Ref($close, %d)/$close" % i ]
105+ names += ["CLOSE%d" % i ]
104106 fields += ["$close/$close" ]
105107 names += ["CLOSE0" ]
106108 for i in range (59 , 0 , - 1 ):
107- fields += ["Ref($open, %d)/$close" % ( i ) ]
108- names += ["OPEN%d" % ( i ) ]
109+ fields += ["Ref($open, %d)/$close" % i ]
110+ names += ["OPEN%d" % i ]
109111 fields += ["$open/$close" ]
110112 names += ["OPEN0" ]
111113 for i in range (59 , 0 , - 1 ):
112- fields += ["Ref($high, %d)/$close" % ( i ) ]
113- names += ["HIGH%d" % ( i ) ]
114+ fields += ["Ref($high, %d)/$close" % i ]
115+ names += ["HIGH%d" % i ]
114116 fields += ["$high/$close" ]
115117 names += ["HIGH0" ]
116118 for i in range (59 , 0 , - 1 ):
117- fields += ["Ref($low, %d)/$close" % ( i ) ]
118- names += ["LOW%d" % ( i ) ]
119+ fields += ["Ref($low, %d)/$close" % i ]
120+ names += ["LOW%d" % i ]
119121 fields += ["$low/$close" ]
120122 names += ["LOW0" ]
121123 for i in range (59 , 0 , - 1 ):
122- fields += ["Ref($vwap, %d)/$close" % ( i ) ]
123- names += ["VWAP%d" % ( i ) ]
124+ fields += ["Ref($vwap, %d)/$close" % i ]
125+ names += ["VWAP%d" % i ]
124126 fields += ["$vwap/$close" ]
125127 names += ["VWAP0" ]
126128 for i in range (59 , 0 , - 1 ):
127- fields += ["Ref($volume, %d)/($volume+1e-12)" % ( i ) ]
128- names += ["VOLUME%d" % ( i ) ]
129+ fields += ["Ref($volume, %d)/($volume+1e-12)" % i ]
130+ names += ["VOLUME%d" % i ]
129131 fields += ["$volume/($volume+1e-12)" ]
130132 names += ["VOLUME0" ]
131133
@@ -134,7 +136,7 @@ def get_feature_config(self):
134136
135137class Alpha360vwap (Alpha360 ):
136138 def get_label_config (self ):
137- return ( ["Ref($vwap, -2)/Ref($vwap, -1) - 1" ], ["LABEL0" ])
139+ return ["Ref($vwap, -2)/Ref($vwap, -1) - 1" ], ["LABEL0" ]
138140
139141
140142class Alpha158 (DataHandlerLP ):
@@ -151,7 +153,7 @@ def __init__(
151153 process_type = DataHandlerLP .PTYPE_A ,
152154 filter_pipe = None ,
153155 inst_processor = None ,
154- ** kwargs ,
156+ ** kwargs
155157 ):
156158 infer_processors = check_transform_proc (infer_processors , fit_start_time , fit_end_time )
157159 learn_processors = check_transform_proc (learn_processors , fit_start_time , fit_end_time )
@@ -161,7 +163,7 @@ def __init__(
161163 "kwargs" : {
162164 "config" : {
163165 "feature" : self .get_feature_config (),
164- "label" : kwargs .get ("label" , self .get_label_config ()),
166+ "label" : kwargs .pop ("label" , self .get_label_config ()),
165167 },
166168 "filter_pipe" : filter_pipe ,
167169 "freq" : freq ,
@@ -176,6 +178,7 @@ def __init__(
176178 infer_processors = infer_processors ,
177179 learn_processors = learn_processors ,
178180 process_type = process_type ,
181+ ** kwargs
179182 )
180183
181184 def get_feature_config (self ):
@@ -190,7 +193,7 @@ def get_feature_config(self):
190193 return self .parse_config_to_fields (conf )
191194
192195 def get_label_config (self ):
193- return ( ["Ref($close, -2)/Ref($close, -1) - 1" ], ["LABEL0" ])
196+ return ["Ref($close, -2)/Ref($close, -1) - 1" ], ["LABEL0" ]
194197
195198 @staticmethod
196199 def parse_config_to_fields (config ):
@@ -426,4 +429,4 @@ def use(x):
426429
427430class Alpha158vwap (Alpha158 ):
428431 def get_label_config (self ):
429- return ( ["Ref($vwap, -2)/Ref($vwap, -1) - 1" ], ["LABEL0" ])
432+ return ["Ref($vwap, -2)/Ref($vwap, -1) - 1" ], ["LABEL0" ]
0 commit comments