def getNews(self): token = '60517739976b768e07823056c6f9cb0fee33ed55a1709b3eaa14a76c6a1b7a56' ts.set_token(token) print ts.get_token() mkt = ts.Market() df = mkt.TickRTSnapshot(securityID='000001.XSHE') print df
def quanshan(): #Failed ts.set_token('de0596189f600d1dc59c509e5b6a1387e4e29cb6225697a25ef9d5d2a425d854') ts.get_token() mt = ts.Market() print(mt) df = mt.TickRTSnapshot(securityID='000001.XSHE') print(df)
def findDatayes_data(self): logging.debug("begin findDatayes_data") print(ts.get_token()) mkt = ts.Market() df = mkt.TickRTSnapshot(securityID='000001.XSHE') print("df:"+df) logging.debug("end findDatayes_data")
def run(self): logging.debug("begin run") logging.debug("begin findDatayes_data") print(ts.get_token()) mkt = ts.Market() df = mkt.TickRTSnapshot(securityID='000001.XSHE') print("df:"+df) logging.debug("end findDatayes_data") #self.findDatayes_data() self._selfSignal.emit() logging.debug(" run with trigger.emit")
def set_token(): if ts.get_token() is None: ts.set_token('03d8d816cd281b447e2809dfbac371a992620752da35392f5ea41c1be5e3f827') print('已设置token凭证码')
def get_Options(**params): try: logger.info('get options data starting...') fd = ts.Options() df = fd.Opt(ontractStatus='L,DE', field='optID,secShortName,varShortName,listDate') logger.info('get options data end...') except: logger.exception('some errors between get options data: ') return df @download_decorator.download_json_file def get_IVs(**params): try: logger.info('get IV data starting...') iv = ts.IV() df = iv.DerIv(**params) logger.info('get IV data end...') except: logger.exception('some errors between get IV data: ') return df if __name__ == '__main__': print ts.get_token() fd = ts.Options() df = fd.Opt(contractStatus='L,DE', field='optID,secShortName,varShortName,listDate') print df mkt = ts.Market() df = mkt.TickRTSnapshot(securityID='000001.XSHE')
# coding: 'utf-8' __author__ = 'xlyang0211' import tushare as ts ts.set_token("efe5e687247788b99191f7fe13357d13b23e89a1df6989ec597d9b8c12a51403") print ts.get_token() print ts.get_industry_classified() # print fd
# -*- coding: utf-8 -*- import tushare as ts token = '3207956af0aa3427e75a0ae1b294d990870373905df065302ae2311b7b3a8d07' ts.set_token(token) mkt = ts.Market() df = mkt.TickRTSnapshot(securityID='000001.XSHE') print('my token = ', ts.get_token()) print(df)
def setToken(token): ts.set_token(token) print(ts.get_token())
def setup_token(): ts.set_token('xxx') token = ts.get_token() print token
def get_token(): """获取调用凭证""" return ts.get_token()
def set_token(): token = ts.get_token() if not token or len(token) == 0: print 'set token' ts.set_token(Constants.TOKEN)