File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -260,13 +260,13 @@ cdef class SecurityValueHolder(object):
260260 for j, dict_data in enumerate (split_values):
261261 self .push(dict_data)
262262 end_count = start_count + len (dict_data)
263- narr_view = self .value_by_names(split_category[j]).values
263+ narr_view = self .value_by_names(split_category[j]).values.astype( float )
264264 output_values[start_count:end_count] = narr_view
265265 start_count = end_count
266266 else :
267267 for j, dict_data in enumerate (split_values):
268268 self .push(dict_data)
269- output_values[j] = self .value_by_name(split_category[j][0 ])
269+ output_values[j] = float ( self .value_by_name(split_category[j][0 ]) )
270270
271271 df = pd.DataFrame(np.array(output_values), index = data.index, columns = [name])
272272 if not dummy_category:
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ u"""
3+ Created on 2019-2-16
4+
5+ @author: cheng.li
6+ """
7+
8+ import os
9+ from PyFin .api import *
10+ from alphamind .api import *
11+
12+
13+ universe_name = 'zz1000'
14+ formula = CSBottomN (LAST ('ROE' ), 20 )
15+ ref_date = '2019-02-13'
16+
17+ depends = formula .fields
18+
19+ engine = SqlEngine (os .environ ['DB_URI' ])
20+ universe = Universe (universe_name )
21+ codes = universe .query (engine , dates = [ref_date ])
22+
23+ factors = engine .fetch_factor (ref_date , depends , codes .code .tolist ())
24+ factors .index = [1 ] * len (factors )
25+ factors = factors [['code' ] + depends ]
26+
27+ res = formula .transform (factors , name = 'factor' , category_field = 'code' )
28+
29+ print (res [res .factor == 1 ])
You can’t perform that action at this time.
0 commit comments