| | |
| | | """ |
| | | 全局临时变量 |
| | | """ |
| | | |
| | | # 代码行业映射 |
| | | |
| | | import code_volumn_manager |
| | | import gpcode_manager |
| | | |
| | | import ths_industry_util |
| | | from code_data_util import ZYLTGBUtil |
| | | |
| | | TEST = True |
| | | |
| | | code_industry_map = {} |
| | | # 行业代码映射 |
| | |
| | | big_money_num = {} |
| | | # 涨停时间 |
| | | limit_up_time = {} |
| | | |
| | | |
| | | def init(): |
| | | load_volumn() |
| | | load_zyltgb() |
| | | load_industry() |
| | | load_name_codes() |
| | | |
| | | |
| | | # 加载行业数据 |
| | | def load_industry(): |
| | | _code_industry_map, _industry_codes_map = ths_industry_util.get_code_industry_maps() |
| | | code_industry_map.clear() |
| | | code_industry_map.update(_code_industry_map) |
| | | industry_codes_map.clear() |
| | | industry_codes_map.update(_industry_codes_map) |
| | | |
| | | |
| | | # 加载目标标的的自由流通股本 |
| | | def load_zyltgb(): |
| | | codes = gpcode_manager.get_gp_list() |
| | | for code in codes: |
| | | result = ZYLTGBUtil.get(code) |
| | | if result is not None: |
| | | zyltgb_map[code] = result |
| | | |
| | | |
| | | # 加载名称代码隐射 |
| | | def load_name_codes(): |
| | | dict_ = gpcode_manager.get_name_codes() |
| | | if dict_: |
| | | for key in dict_: |
| | | name_codes[key] = dict_[key] |
| | | |
| | | |
| | | # 加载量 |
| | | def load_volumn(): |
| | | codes = gpcode_manager.get_gp_list() |
| | | for code in codes: |
| | | max60, yesterday = code_volumn_manager.get_histry_volumn(code) |
| | | today = code_volumn_manager.get_today_volumn(code) |
| | | max60_volumn[code] = max60 |
| | | yesterday_volumn[code] = yesterday |
| | | today_volumn[code] = today |
| | | |
| | | |
| | | # 添加今日涨停数据 |
| | | def add_limit_up_codes(datas, clear=False): |
| | | if datas is None: |
| | | return |
| | | if clear: |
| | | today_limit_up_codes.clear() |
| | | # 涨停数量 |
| | | __dict = {} |
| | | for data in datas: |
| | | __dict[data["code"]] = data |
| | | # print(__dict) |
| | | today_limit_up_codes.update(__dict) |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | load_zyltgb() |
| | | print(zyltgb_map["002819"]) |
| | | # 现价 |
| | | cuurent_prices = {} |