| | |
| | | """ |
| | | |
| | | # l2交易因子 |
| | | |
| | | |
| | | import big_money_num_manager |
| | | import global_util |
| | | import limit_up_time_manager |
| | | import log |
| | | |
| | | |
| | | class L2TradeFactorUtil: |
| | |
| | | # 纯万手哥影响值(手数》=9000 OR 金额》=500w) |
| | | @classmethod |
| | | def get_big_money_rate(cls, num): |
| | | if num < 0: |
| | | num = 0 |
| | | if num >= 10: |
| | | return 0.5 |
| | | else: |
| | |
| | | @classmethod |
| | | def compute_rate_by_code(cls, code): |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | total_industry_limit_percent = global_util.industry_hot_num.get(code) |
| | | # 获取行业热度 |
| | | industry = global_util.code_industry_map.get(code) |
| | | if industry is None: |
| | | global_util.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() |
| | | 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) |
| | | # 首次涨停时间 |
| | | limit_up_time = global_util.limit_up_time.get(code) |
| | | if limit_up_time is None: |
| | | limit_up_time = limit_up_time_manager.get_limit_up_time(code) |
| | | |
| | | 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) |
| | | return cls.compute_rate(zyltgb, total_industry_limit_percent, volumn_day60_max, volumn_yest, volumn_today, |
| | | limit_up_time, big_money_num) |
| | | |
| | |
| | | if zyltgb is None: |
| | | print("没有获取到自由流通市值") |
| | | return 10000000 |
| | | if code == '002476': |
| | | print("") |
| | | zyltgb = cls.get_base_safe_val(zyltgb) |
| | | rate = cls.compute_rate_by_code(code) |
| | | # print("m值获取:", code, round(zyltgb * rate)) |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | print(L2TradeFactorUtil.get_big_money_rate(1)) |
| | | print(L2TradeFactorUtil.get_big_money_rate(2)) |
| | | print(L2TradeFactorUtil.get_big_money_rate(3)) |
| | | L2TradeFactorUtil.compute_m_value("000036") |
| | | # print(L2TradeFactorUtil.get_big_money_rate(1)) |
| | | # print(L2TradeFactorUtil.get_big_money_rate(2)) |
| | | # print(L2TradeFactorUtil.get_big_money_rate(3)) |