| | |
| | | global_util.industry_hot_num = industry_hot_dict |
| | | |
| | | |
| | | # 获取相同行业的代码 |
| | | # 返回:行业,同行业代码 |
| | | def get_same_industry_codes(code, codes): |
| | | industry = global_util.code_industry_map.get(code) |
| | | if industry is None: |
| | | global_util.load_industry() |
| | | industry = global_util.code_industry_map.get(code) |
| | | if industry is None: |
| | | return None,None |
| | | codes_ = set() |
| | | for code_ in codes: |
| | | if global_util.code_industry_map.get(code_) == industry: |
| | | # 同一行业 |
| | | codes_.add(code_) |
| | | return industry, codes_ |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | _code_map, _industry_map = get_code_industry_maps() |
| | | print(_code_map, _industry_map) |