Skip to content

Commit

Permalink
future update
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmysoa committed Oct 17, 2016
1 parent 76465be commit 973215b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -82,6 +82,6 @@ def read(fname):
'Programming Language :: Python :: 3.4',
'License :: OSI Approved :: BSD License'],
packages=['tushare','tushare.stock', 'tushare.data', 'tushare.util', 'tushare.datayes',
'tushare.internet', 'tushare.fund', 'tushare.trader'],
'tushare.internet', 'tushare.fund', 'tushare.trader', 'tushare.futures'],
package_data={'': ['*.csv']},
)
6 changes: 1 addition & 5 deletions tushare/futures/intlfutures.py
Expand Up @@ -24,17 +24,13 @@ def get_intlfuture(symbols=None):
df = _get_data(ct.INTL_FUTURE_URL%(ct.P_TYPE['http'], ct.DOMAINS['EM'],
ct.PAGES['INTL_FUT'], symbols,
_random(17)))
print(df)
return df

def _get_data(url):
try:
request = Request(url)
data_str = urlopen(request, timeout=10).read()
# data_str = data_str.decode('GBK')
data_str = data_str.split('=')[1]
# data_str = """
# {futures:["CONX0,CONX,美原油11,50.32,50.23,49.80,50.58,49.72,0,137713,0.00,0,0,50.32,0.00,0,181562,-0.52,-1.03%,0.00,831,137713,0,-1,1,0.00,0.00,2016-10-17 21:38:49,0","GLNZ0,GLNZ,美黄金12,1251.7,1252.6,1256.9,1258.0,1251.1,0,67082,0.0,0,0,1251.7,0.0,0,373385,5.2,0.42%,0.0,62,67082,0,-1,0,0.0,0.0,2016-10-17 21:38:41,0"]}
# """
data_str = data_str.replace('futures', '"futures"')
if six.PY3:
data_str = data_str.decode('utf-8')
Expand Down

0 comments on commit 973215b

Please sign in to comment.