def get_stock_basics(date=None):
 wdate = (du.last_tddate() if (date is None) else date)
 wdate = wdate.replace('-', '')
 if (wdate < '20160809'):
  return None
 datepre = ('' if (date is None) else ((wdate[0:4] + wdate[4:6]) + '/'))
 request = Request((ct.ALL_STOCK_BASICS_FILE % (datepre, ('' if (date is None) else wdate))))
 text = urlopen(request, timeout=10).read()
 text = text.decode('GBK')
 text = text.replace('--', '')
 df = pd.read_csv(StringIO(text), dtype={'code': 'object'})
 df = df.set_index('code')
 return df

def get_stock_basics ( date = None ) : wdate = ( du . last_tddate ( ) if ( date is None ) else date ) wdate = wdate . replace ( '-' , '' ) if ( wdate < '20160809' ) : return None datepre = ( '' if ( date is None ) else ( ( wdate [ 0 : 4 ] + wdate [ 4 : 6 ] ) + '/' ) ) request = Request ( ( ct . ALL_STOCK_BASICS_FILE % ( datepre , ( '' if ( date is None ) else wdate ) ) ) ) text = urlopen ( request , timeout = 10 ) . read ( ) text = text . decode ( 'GBK' ) text = text . replace ( '--' , '' ) df = pd . read_csv ( StringIO ( text ) , dtype = { 'code' : 'object' } ) df = df . set_index ( 'code' ) return df
parameters date:日期yyyy-mm-dd，默认为上一个交易日，目前只能提供2016-08-09之后的历史数据 return dataframe code .