Skip to content

Commit

Permalink
update 财务数据!
Browse files Browse the repository at this point in the history
update 财务数据!
  • Loading branch information
yutiansut authored Aug 22, 2019
2 parents 260923e + 0c0c0ce commit 61af95e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions QUANTAXIS/QAFetch/QAfinancial.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
参见PYTDX 1.65
"""

FINANCIAL_URL = 'http://down.tdx.com.cn:8001/fin/gpcw.txt'
FINANCIAL_URL = 'https://gitee.com/yutiansut/QADATA/raw/master/financial/content.txt'


class QAHistoryFinancialCrawler(HistoryFinancialCrawler):
Expand Down Expand Up @@ -79,27 +79,26 @@ def get_filename():
"""
get_filename
"""
return [(l[0],l[1]) for l in [line.strip().split(",") for line in requests.get(FINANCIAL_URL).text.strip().split('\n')]]

return [(l[0], l[1]) for l in [line.strip().split(",") for line in requests.get(FINANCIAL_URL).text.strip().split('\n')]]


def get_md5():
return [l[1] for l in [line.strip().split(",") for line in requests.get(FINANCIAL_URL).text.strip().split('\n')]]


def download_financialzip():
"""
会创建一个download/文件夹
"""
result = get_filename()
res = []
for item, md5 in result:
if item in os.listdir(download_path) and md5==QA_util_file_md5('{}{}{}'.format(download_path,os.sep,item)):
if item in os.listdir(download_path) and md5 == QA_util_file_md5('{}{}{}'.format(download_path, os.sep, item)):

print('FILE {} is already in {}'.format(item, download_path))
else:
print('CURRENTLY GET/UPDATE {}'.format(item[0:12]))
r = requests.get('http://down.tdx.com.cn:8001/fin/{}'.format(item))

r = requests.get('http://data.yutiansut.com/{}'.format(item))
file = '{}{}{}'.format(download_path, os.sep, item)

with open(file, "wb") as code:
Expand All @@ -121,7 +120,7 @@ def parse_all():
"""
解析目录下的所有文件
"""
#filepath = '{}{}{}{}'.format(qa_path, os.sep, 'downloads', os.sep)
# filepath = '{}{}{}{}'.format(qa_path, os.sep, 'downloads', os.sep)
filename = os.listdir(download_path)

return parse_filelist(filename)
Expand Down
2 changes: 1 addition & 1 deletion QUANTAXIS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
2017/4/8
"""

__version__ = '1.5.10'
__version__ = '1.5.11'
__author__ = 'yutiansut'

import argparse
Expand Down

0 comments on commit 61af95e

Please sign in to comment.