Administrator
2024-06-19 ff14ed4736013d224ddd6582e8229a01074d542f
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
from code_attribute.code_data_util import ZYLTGBUtil
from code_attribute.gpcode_manager import CodePrePriceManager
from huaxin_client import l1_subscript_codes_manager
from log_module.async_log_util import huaxin_l2_log
from log_module.log import logger_local_huaxin_l2_error
from third_data import history_k_data_util, kpl_api
 
if __name__ == "__main__":
    codes_sh, codes_sz = l1_subscript_codes_manager.get_codes(False)
    codes = set()
    if codes_sh:
        for code_byte in codes_sh:
            codes.add(code_byte.decode())
        for code_byte in codes_sz:
            codes.add(code_byte.decode())
 
    updated_codes = ZYLTGBUtil.get_today_updated_volume_codes()
    codes = codes - set(updated_codes)
 
    # 获取最近的价格
    price_datas = history_k_data_util.JueJinApi.get_gp_current_info(codes, "symbol,price")
    price_dict = {x['symbol'].split(".")[1]: x['price'] for x in price_datas}
    for code in price_dict:
        try:
            zylt = kpl_api.getZYLTAmount(code)
            ZYLTGBUtil.save_volume(code, int(zylt / price_dict[code]))
        except:
            pass