Skip to content

Commit

Permalink
update change
Browse files Browse the repository at this point in the history
  • Loading branch information
Rockyzsu committed Jan 18, 2019
1 parent 83b6d71 commit 8188351
Show file tree
Hide file tree
Showing 17 changed files with 523 additions and 245 deletions.
1 change: 1 addition & 0 deletions BaseService.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#-*-coding=utf-8-*-
import os
import tushare as ts

def changeDir():
cwnd = os.getcwd()
os.chdir(os.path.join(cwnd, 'data'))
Expand Down
18 changes: 10 additions & 8 deletions alert_me.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

logger = llogger(__file__)

# 5秒循环检测一次
# 循环检测时间
LOOP_TIME = 60
EXECEPTION_TIME = 1
MARKET_OPENING = 0
Expand Down Expand Up @@ -78,6 +78,7 @@ def monitor(self):
price_df = ts.quotes(self.code_lists, conn=self.api)
except Exception as e:
logger.error('获取持仓数据异常>>> {}'.format(e))

try:
self.api=ts.get_apis()
except Exception as e:
Expand Down Expand Up @@ -105,9 +106,9 @@ def monitor(self):
ret = ret_df[list(rename_column.values())]
ret = ret.reset_index(drop=True)

# 推送
content = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+'\n'+ret.to_string()
try:
wechat.send_content(ret.to_string())
wechat.send_content(content)
except Exception as e:
logger.error('微信发送失败 {}'.format(e))

Expand Down Expand Up @@ -150,11 +151,12 @@ def monitor(self):
ret_dt['name'] = name_list
ret_dt[u'溢价率'] = yjl_list
ret_dt = ret_dt.sort_values(by='percent', ascending=False)
ret_dt = ret_dt.reset_index(drop=True)

ret_dt1 = ret_dt.reset_index(drop=True)

content0 = datetime.datetime.now().strftime(
'%Y-%m-%d %H:%M:%S') + '\n' + ret_dt1.to_string()
try:
wechat.send_content(ret_dt.to_string())
wechat.send_content(content0)
except Exception as e:
logger.info('发送微信失败')
logger.info(e)
Expand Down Expand Up @@ -196,9 +198,9 @@ def monitor(self):
ret_dt_pool['name'] = name_list_pool
ret_dt_pool = ret_dt_pool.sort_values(by='percent', ascending=False)
ret_dt_pool = ret_dt_pool.reset_index(drop=True)

content1 = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+'\n'+ret_dt_pool.to_string()
try:
wechat.send_content(ret_dt_pool.to_string())
wechat.send_content(content1)

except Exception as e:
logger.error('微信发送异常{}'.format(e))
Expand Down
2 changes: 1 addition & 1 deletion black_list_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def update_data(filename,conn):
conn.commit()

except Exception as e:
logger.error(e)
logger.info(e)
logger.info('dup code {}'.format(code))
conn.rollback()
continue
Expand Down
113 changes: 0 additions & 113 deletions bond_statistics.py

This file was deleted.

2 changes: 1 addition & 1 deletion ceiling_break.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def send_txt(self, name, content):
self.smtp.sendmail(self.msg['from'], self.msg['to'], self.msg.as_string())
self.smtp.quit()
print("sent")
except smtplib.SMTPException, e:
except smtplib.SMTPException as e:
print(e)
return 0

Expand Down
3 changes: 2 additions & 1 deletion collect_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ def main():
if is_holiday():
logger.info("Holidy")
exit()
main()
main()
logger.info('完成')
Loading

0 comments on commit 8188351

Please sign in to comment.