Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Rockyzsu committed Nov 9, 2020
1 parent dcba388 commit 48a43d9
Show file tree
Hide file tree
Showing 12 changed files with 231 additions and 136 deletions.
38 changes: 34 additions & 4 deletions BaseService.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
#-*-coding=utf-8-*-
import os
import tushare as ts
from loguru import logger
import requests
import config

def changeDir():
cwnd = os.getcwd()
os.chdir(os.path.join(cwnd, 'data'))
class BaseService:

def __init__(self, logfile='default.log'):
self.logger = logger
self.logger.add(logfile)

def check_path(self, path):
if not os.path.exists(path):
try:
os.makedirs(path)
except Exception as e:
self.logger.error(e)

def get_filename(self, url):
return url.split('/')[-1]

def notify(self,text):
url = f"https://sc.ftqq.com/{config.WECHAT_ID}.send?text=" + text
try:
res = requests.get(url)
except Exception as e:
print(e)
return False
else:
return True

def save_iamge(self, content, path):
with open(path, 'wb') as fp:
fp.write(content)

def get(self,url):
raise NotImplemented

def post(self):
raise NotImplemented

8 changes: 4 additions & 4 deletions StockAnalyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ def main():
# print(v, ratio)

## 涨跌幅分布 #####
# today=datetime.datetime.now().strftime("%Y-%m-%d")
# today_tendency(today)
# TODAY=datetime.datetime.now().strftime("%Y-%m-%d")
# today_tendency(TODAY)

## 分析涨停的区域分布 ####
# today = datetime.datetime.now().strftime("%Y%m%d")
# zt_location(today)
# TODAY = datetime.datetime.now().strftime("%Y%m%d")
# zt_location(TODAY)

## 显示百分比价格
# show_percentage(121)
Expand Down
2 changes: 1 addition & 1 deletion fetch_each_day.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FetchDaily(object):
def __init__(self):

self.today = datetime.datetime.now().strftime('%Y-%m-%d')
# self.today = '2020-02-07'
# self.TODAY = '2020-02-07'
self.path = DATA_PATH
if not os.path.exists(self.path):
try:
Expand Down
Loading

0 comments on commit 48a43d9

Please sign in to comment.