sort_stocks = {}
for stock in g.candidate:
q=query(finance.STK_HOLDER_NUM).filter(finance.STK_HOLDER_NUM.code==stock,finance.STK_HOLDER_NUM.pub_date>'2019-01-01').limit(2)
df=finance.run_query(q)
holders_curr=df.a_share_holders.ix[1]
holders_pre=df.a_share_holders.ix[0]
if holders_curr!=None and holders_pre!=None:
holder_reduce_ratio=holders_curr/holders_pre
sort_stocks[stock] = holder_reduce_ratio
df = pd.DataFrame({'holder_reduce_ratio':sort_stocks})
df = df.sort_values(by='holder_reduce_ratio', ascending=True)
g.buylist = df.index[:30]