Skip to content

Commit

Permalink
get_today_all #301
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmysoa committed Mar 13, 2017
1 parent 7234ea9 commit 42fa8f9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tushare/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.6.9'
__version__ = '0.7.0'
__author__ = 'Jimmy Liu'
"""
for trading data
Expand Down
3 changes: 2 additions & 1 deletion tushare/stock/cons.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
DAY_PRICE_URL = '%sapi.finance.%s/%s/?code=%s&type=last'
LIVE_DATA_URL = '%shq.%s/rn=%s&list=%s'
DAY_PRICE_MIN_URL = '%sapi.finance.%s/akmin?scode=%s&type=%s'
SINA_DAY_PRICE_URL = '%s%s/quotes_service/api/%s/Market_Center.getHQNodeData?num=80&sort=code&asc=0&node=hs_a&symbol=&_s_r_a=page&page=%s'
# SINA_DAY_PRICE_URL = '%s%s/quotes_service/api/%s/Market_Center.getHQNodeData?num=80&sort=code&asc=0&node=hs_a&symbol=&_s_r_a=page&page=%s'
SINA_DAY_PRICE_URL = '%s%s/quotes_service/api/%s/Market_Center.getHQNodeData?num=10000&node=hs_a'
REPORT_URL = '%s%s/q/go.php/vFinanceAnalyze/kind/mainindex/%s?s_i=&s_a=&s_c=&reportdate=%s&quarter=%s&p=%s&num=%s'
FORECAST_URL = '%s%s/q/go.php/vFinanceAnalyze/kind/performance/%s?s_i=&s_a=&s_c=&s_type=&reportdate=%s&quarter=%s&p=%s&num=%s'
PROFIT_URL = '%s%s/q/go.php/vFinanceAnalyze/kind/profit/%s?s_i=&s_a=&s_c=&reportdate=%s&quarter=%s&p=%s&num=%s'
Expand Down
15 changes: 8 additions & 7 deletions tushare/stock/trading.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def _parsing_dayprice_json(pageNum=1):
-------
DataFrame 当日所有股票交易数据(DataFrame)
"""
ct._write_console()
# ct._write_console()
request = Request(ct.SINA_DAY_PRICE_URL%(ct.P_TYPE['http'], ct.DOMAINS['vsf'],
ct.PAGES['jv'], pageNum))
ct.PAGES['jv']))
text = urlopen(request, timeout=10).read()
if text == 'null':
return None
Expand Down Expand Up @@ -290,12 +290,12 @@ def get_today_all():
DataFrame
属性:代码,名称,涨跌幅,现价,开盘价,最高价,最低价,最日收盘价,成交量,换手率,成交额,市盈率,市净率,总市值,流通市值
"""
ct._write_head()
# ct._write_head()
df = _parsing_dayprice_json(1)
if df is not None:
for i in range(2, ct.PAGE_NUM[0]):
newdf = _parsing_dayprice_json(i)
df = df.append(newdf, ignore_index=True)
# if df is not None:
# for i in range(2, ct.PAGE_NUM[0]):
# newdf = _parsing_dayprice_json(i)
# df = df.append(newdf, ignore_index=True)
return df


Expand Down Expand Up @@ -750,3 +750,4 @@ def _code_to_symbol(code):
else:
return 'sh%s'%code if code[:1] in ['5', '6', '9'] else 'sz%s'%code


0 comments on commit 42fa8f9

Please sign in to comment.