| | |
| | | # 同花顺行业 |
| | | import global_util |
| | | import mongo_data |
| | | |
| | | |
| | |
| | | return __code_map, __industry_map |
| | | |
| | | |
| | | # 设置行业热度 |
| | | def set_industry_hot_num(limit_up_datas): |
| | | industry_hot_dict = {} |
| | | code_industry_map = global_util.code_industry_map |
| | | if code_industry_map is None or len(code_industry_map) == 0: |
| | | global_util.load_industry(); |
| | | code_industry_map = global_util.code_industry_map |
| | | if code_industry_map is None: |
| | | raise Exception("获取代码对应的行业出错") |
| | | |
| | | for data in limit_up_datas: |
| | | code = data["code"] |
| | | industry = code_industry_map.get(code) |
| | | if industry is None: |
| | | # 获取代码对应的行业出错 |
| | | continue |
| | | if industry_hot_dict.get(industry) is None: |
| | | industry_hot_dict.setdefault(industry, 0) |
| | | |
| | | percent = float(data["limitUpPercent"]) |
| | | if percent > 21: |
| | | percent = 21 |
| | | industry_hot_dict[industry] = round(industry_hot_dict[industry] + percent, 2) |
| | | |
| | | global_util.industry_hot_num = industry_hot_dict |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | _code_map, _industry_map = get_code_industry_maps() |
| | | print(_code_map,_industry_map) |
| | | print(_code_map, _industry_map) |