Skip to content

Commit

Permalink
修改字符
Browse files Browse the repository at this point in the history
  • Loading branch information
Rockyzsu committed Apr 9, 2019
1 parent 4cc3fd9 commit 0153aab
Show file tree
Hide file tree
Showing 25 changed files with 230 additions and 227 deletions.
4 changes: 2 additions & 2 deletions alert_me.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ def stock_pool(self):
pool_table = 'tb_current_hold'
pool_df = pd.read_sql(pool_table, self.engine, index_col='index')

return list(pool_df[u'代码'].values), list(pool_df[u'名字'].values)
return list(pool_df['代码'].values), list(pool_df['名字'].values)

# 获取市场所有可转债数据个股代码 正股
def zg_bond(self):
bond_table = 'tb_bond_jisilu'
bond_table = 'tb_bond_jisil'

try:
jsl_df = pd.read_sql(bond_table, self.engine)
Expand Down
14 changes: 7 additions & 7 deletions analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def today_tendency(today):
p_25=stats.scoreatpercentile(df['changepercent'],25)
p_50=stats.scoreatpercentile(df['changepercent'],50)
p_75=stats.scoreatpercentile(df['changepercent'],75)
print(u'中位数: {}'.format(median))
print(u'平均数: {}'.format(mean))
print(u'方差: {}'.format(std))
print(u'25%: {}'.format(p_25))
print(u'50%: {}'.format(p_50))
print(u'75%: {}'.format(p_75))
print('中位数: {}'.format(median))
print('平均数: {}'.format(mean))
print('方差: {}'.format(std))
print('25%: {}'.format(p_25))
print('50%: {}'.format(p_50))
print('75%: {}'.format(p_75))

'''
分析昨天涨停的区域分布
Expand All @@ -40,7 +40,7 @@ def yesterday_zt_location(date='20180404'):
df = pd.read_sql(date+'zdt',engine_zdt,index_col='index')
df_basic = pd.read_sql('basic_info',engine_basic,index_col='index')
result={}
for code in df[u'代码'].values:
for code in df['代码'].values:
try:
area=df_basic[df_basic['code']==code]['area'].values[0]
result.setdefault(area,0)
Expand Down
2 changes: 1 addition & 1 deletion auto_trader.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_candidates(self):
return stock_candidate_df

def get_market_data(self):
market_data_df = pd.read_sql('tb_bond_jisilu', con=self.engine)
market_data_df = pd.read_sql('tb_bond_jisil', con=self.engine)
return market_data_df

# 永远不买的
Expand Down
2 changes: 1 addition & 1 deletion bond_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ConvertBond():

def __init__(self):
self.conn=ts.get_apis()
self.available_bonds = pd.read_sql('tb_bond_jisilu', engine, index_col='index')[u'可转债代码'].values
self.available_bonds = pd.read_sql('tb_bond_jisil', engine, index_col='index')['可转债代码'].values
self.allBonds=ts.new_cbonds(default=0,pause=2)
self.onSellBond=self.allBonds.dropna(subset=['marketprice'])
self.today=datetime.datetime.now().strftime('%Y-%m-%d %H:%M')
Expand Down
2 changes: 1 addition & 1 deletion ceiling_break.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import threading
from setting import get_engine,sendmail
# from setting import MsgSend
# msg = MsgSend(u'wei')
# msg = MsgSend('wei')

EXCEPTION_TIME_OUT = 60
NORMAL_TIME_OUT = 3
Expand Down
8 changes: 4 additions & 4 deletions daily_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ def main():
code_list =df['code'].values
engine = get_engine('db_zdt')
zt_df = pd.read_sql(tb_name,engine,index_col='index')
zt_df[u'涨停强度']=map(lambda x:round(x,0),zt_df[u'涨停强度'])
ret_df = zt_df[zt_df[u'代码'].isin(code_list)]
zt_df['涨停强度']=map(lambda x:round(x,0),zt_df['涨停强度'])
ret_df = zt_df[zt_df['代码'].isin(code_list)]
if not ret_df.empty:
tb_name_save = today+'_cx'
excel_name = today+'_cx.xls'
ret_df.to_excel(excel_name,encoding='gbk')
ret_df.to_sql(tb_name_save,engine)
s= ret_df[[u'代码',u'名称',u'涨停强度',u'打开次数',u'第一次涨停时间',u'最后一次涨停时间']].to_string()
sendmail(s,today+u'次新涨停')
s= ret_df[['代码','名称','涨停强度','打开次数','第一次涨停时间','最后一次涨停时间']].to_string()
sendmail(s,today+'次新涨停')

if __name__ == '__main__':
main()
Loading

0 comments on commit 0153aab

Please sign in to comment.