Administrator
2022-09-18 b946684114d097e937b766f986d12c7eea8edce8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# 代码行业映射
import pymongo
 
import ths_industry_util
import gpcode_manager
import mongo_data
 
code_industry_map = {}
# 行业代码映射
industry_codes_map = {}
# 自由流通市值映射
zyltgb_map = {}
# 今日涨停代码隐射
today_limit_up_codes = {}
# 行业热度指数
industry_hot_num = {}
# 今日量
today_volumn = {}
# 60日最大量
max60_volumn = {}
# 昨日量
yesterday_volumn = {}
# 大单
big_money_num = {}
# 涨停时间
limit_up_time = {}
 
 
# 加载行业数据
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:
        results = mongo_data.find("ths-zylt", {"_id": code})
        if results is not None:
            results = [doc for doc in results]
            if len(results) > 0:
                result = results[0]
                if result["zyltgb_unit"] == 0:
                    zyltgb_map[code] = round(float(result["zyltgb"]) * 100000000)
                else:
                    zyltgb_map[code] = round(float(result["zyltgb"]) * 10000)
 
 
# 添加今日涨停数据
def add_limit_up_codes(datas, clear=False):
    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"])