def __init__(self, dbinfo=ct.DB_INFO, redis_host=None, stocks_dir='/data/tdx/history/days', stock_path='/data/tdx/base/stocks.csv'): self.table = ct.STOCK_INFO_TABLE self.redis = create_redis_obj( ) if redis_host is None else create_redis_obj(host=redis_host) self.mysql_client = cmysql.CMySQL(dbinfo, iredis=self.redis) self.mysql_dbs = self.mysql_client.get_all_databases() self.stocks_dir = stocks_dir self.stock_path = stock_path self.industry_info = IndustryInfo.get_industry()
def get_industry(self, code): """获取沪深股股票通达信行业信息""" rdf = IndustryInfo.get_industry() rdf = rdf[rdf.content.str.contains(code)] return rdf['name'].values[0] if not rdf.empty else None