Permalink
Browse files

0.6.7

  • Loading branch information...
1 parent 3424473 commit d6c4a37e2106f46d9974eddb7f283ff76f9a9c35 @jimmysoa jimmysoa committed Dec 27, 2016
Showing with 7 additions and 5 deletions.
  1. +1 −1 tushare/__init__.py
  2. +1 −1 tushare/stock/ref_vars.py
  3. +3 −1 tushare/stock/reference.py
  4. +2 −2 tushare/stock/trading.py
View
@@ -1,4 +1,4 @@
-__version__ = '0.6.5'
+__version__ = '0.6.7'
__author__ = 'Jimmy Liu'
"""
for trading data
@@ -34,7 +34,7 @@
QUARTS_DIC = {'1':('%s-12-31', '%s-03-31'), '2':('%s-03-31', '%s-06-30'),
'3':('%s-06-30', '%s-09-30'), '4':('%s-9-30', '%s-12-31')}
FUND_HOLDS_COLS = ['count', 'clast', 'date', 'ratio', 'amount', 'nums','nlast', 'name', 'code']
-NEW_STOCKS_COLS = ['code', 'name', 'ipo_date', 'issue_date', 'amount', 'markets', 'price', 'pe',
+NEW_STOCKS_COLS = ['code', 'xcode', 'name', 'ipo_date', 'issue_date', 'amount', 'markets', 'price', 'pe',
'limit', 'funds', 'ballot']
MAR_SH_COOKIESTR = '_gscu_1808689395=27850607moztu036'
MAR_SH_HZ_COLS = ['opDate', 'rzye', 'rzmre', 'rqyl', 'rqylje', 'rqmcl', 'rzrqjyzl']
@@ -353,6 +353,7 @@ def new_stocks(retry_count=3, pause=0.001):
------
DataFrame
code:股票代码
+ xcode:申购代码
name:名称
ipo_date:上网发行日期
issue_date:上市日期
@@ -387,9 +388,10 @@ def _newstocks(data, pageNo, retry_count, pause):
sarr = sarr.replace('<font color="red">*</font>', '')
sarr = '<table>%s</table>'%sarr
df = pd.read_html(StringIO(sarr), skiprows=[0, 1])[0]
- df = df.drop([df.columns[idx] for idx in [1, 12, 13, 14]], axis=1)
+ df = df.drop([df.columns[idx] for idx in [12, 13, 14]], axis=1)
df.columns = rv.NEW_STOCKS_COLS
df['code'] = df['code'].map(lambda x : str(x).zfill(6))
+ df['xcode'] = df['xcode'].map(lambda x : str(x).zfill(6))
res = html.xpath('//table[@class=\"table2\"]/tr[1]/td[1]/a/text()')
tag = '下一页' if ct.PY3 else unicode('下一页', 'utf-8')
hasNext = True if tag in res else False
@@ -18,6 +18,7 @@
import re
from pandas.compat import StringIO
from tushare.util import dateu as du
+from tushare.stock.reference import new_stocks
try:
from urllib.request import urlopen, Request
except ImportError:
@@ -650,12 +651,11 @@ def get_k_data(code=None, start='', end='',
urls = []
for year in years:
startdate = str(year) + '-01-01'
- enddate = str(year+1) + '-12-30'
+ enddate = str(year+1) + '-12-31'
url = ct.KLINE_TT_URL%(ct.P_TYPE['http'], ct.DOMAINS['tt'],
kline, fq+str(year), symbol,
ct.TT_K_TYPE[ktype.upper()], startdate, enddate,
fq, _random(17))
- print(url)
urls.append(url)
dataflag = '%s%s'%(fq, ct.TT_K_TYPE[ktype.upper()])
elif ktype in ct.K_MIN_LABELS:

0 comments on commit d6c4a37

Please sign in to comment.