| | |
| | | |
| | | # l2交易因子 |
| | | import big_money_num_manager |
| | | import global_data_loader |
| | | import global_util |
| | | import limit_up_time_manager |
| | | import log |
| | | |
| | | |
| | | class L2TradeFactorUtil: |
| | |
| | | big_money_rate = 0 |
| | | if big_money_num is not None: |
| | | big_money_rate = cls.get_big_money_rate(big_money_num) |
| | | print( |
| | | "industry_rate:{} volumn_rate:{} limit_up_time_rate:{} big_money_rate:{}".format(industry_rate, |
| | | volumn_rate, |
| | | limit_up_time_rate, |
| | | big_money_rate)) |
| | | |
| | | msg = "zyltgb:{} industry_rate:{} volumn_rate:{} limit_up_time_rate:{} big_money_rate:{}".format(zyltgb, |
| | | industry_rate, |
| | | volumn_rate, |
| | | limit_up_time_rate, |
| | | big_money_rate) |
| | | |
| | | final_rate = round(1 - (industry_rate + volumn_rate + limit_up_time_rate + big_money_rate), 4) |
| | | if final_rate < 0.1: |
| | | final_rate = 0.1 |
| | | return final_rate |
| | | return final_rate, msg |
| | | |
| | | @classmethod |
| | | def compute_rate_by_code(cls, code): |
| | |
| | | # 获取行业热度 |
| | | industry = global_util.code_industry_map.get(code) |
| | | if industry is None: |
| | | global_util.load_industry() |
| | | global_data_loader.load_industry() |
| | | industry = global_util.code_industry_map.get(code) |
| | | |
| | | total_industry_limit_percent = global_util.industry_hot_num.get(industry) if industry is not None else None |
| | |
| | | volumn_day60_max, volumn_yest, volumn_today = global_util.max60_volumn.get( |
| | | code), global_util.yesterday_volumn.get(code), global_util.today_volumn.get(code) |
| | | if volumn_day60_max is None or volumn_yest is None: |
| | | global_util.load_volumn() |
| | | global_data_loader.load_volumn() |
| | | volumn_day60_max, volumn_yest, volumn_today = global_util.max60_volumn.get( |
| | | code), global_util.yesterday_volumn.get(code), global_util.today_volumn.get(code) |
| | | # 首次涨停时间 |
| | |
| | | def __get_zyltgb(cls, code): |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | if zyltgb is None: |
| | | global_util.load_zyltgb() |
| | | global_data_loader.load_zyltgb() |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | return zyltgb |
| | | |
| | |
| | | def compute_m_value(cls, code): |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | if zyltgb is None: |
| | | global_util.load_zyltgb() |
| | | global_data_loader.load_zyltgb() |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | if zyltgb is None: |
| | | print("没有获取到自由流通市值") |
| | | return 10000000 |
| | | zyltgb = cls.get_base_safe_val(zyltgb) |
| | | rate = cls.compute_rate_by_code(code) |
| | | rate, msg = cls.compute_rate_by_code(code) |
| | | # print("m值获取:", code, round(zyltgb * rate)) |
| | | return round(zyltgb * rate) |
| | | return round(zyltgb * rate), msg |
| | | |
| | | # 获取安全笔数 |
| | | @classmethod |
| | |
| | | return 30 |
| | | if count < 5: |
| | | return 5 |
| | | return count |
| | | |
| | | big_money_num = global_util.big_money_num.get(code) |
| | | if big_money_num is None: |
| | | big_money_num = big_money_num_manager.get_num(code) |
| | | rate = 0 |
| | | if big_money_num is not None: |
| | | rate = cls.get_big_money_rate(big_money_num) |
| | | |
| | | return round(count*(1-rate/2)) |
| | | |
| | | |
| | | # l2因子归因数据 |