Administrator
2022-09-30 394e24aaba9b28c6427444d47aab6505c735fb7e
l2_trade_factor.py
@@ -9,7 +9,7 @@
        yi = round(zyltgb / 100000000)
        if yi < 1:
            yi = 1
        return 6000000 + (yi - 1) * 500000
        return 5000000 + (yi - 1) * 500000
    # 自由流通市值影响比例
    @classmethod
@@ -32,7 +32,7 @@
    @classmethod
    def get_industry_rate(cls, total_limit_percent):
        t = total_limit_percent / 10
        rate = t / 0.5 * 0.04
        rate = t / 0.5 * 0.02 + 0.26
        if rate > 0.52:
            rate = 0.52
        return round(rate, 2)
@@ -41,23 +41,23 @@
    @classmethod
    def get_volumn_rate(cls, day60_max, yest, today):
        old_volumn = yest
        base_rate = 0.25
        base_rate = 0.49
        if day60_max > yest:
            old_volumn = day60_max
            base_rate = 0.26
            base_rate = 0.50
        r = round(today / old_volumn, 2)
        print("比例:", r)
        rate = 0
        if r < 0.11:
            rate = base_rate - (r - 0.01)
        elif r < 0.45:
            rate = base_rate - r
        if r <= 0.25:
            rate = base_rate - (r - 0.01) * 2
        elif r <= 0.5:
            rate = 0.25 - r + (0.01 if day60_max > yest else 0)
        elif r < 0.75:
            rate = (base_rate - 0.2049) + (r - 0.74) * 0.4
        elif r < 1.38:
            rate = base_rate - (r - 0.75) * 0.8
            rate = r - 0.75 + (0.01 if day60_max > yest else 0)
        elif r < 1.74:
            rate = base_rate - (r - 0.75)
        else:
            rate = base_rate - 0.5
            rate = base_rate - 0.99
        return round(rate, 4)
    # 当前股票首次涨停时间的影响比例
@@ -67,28 +67,28 @@
        start_m = 9 * 60 + 30
        m = int(times[0]) * 60 + int(times[1])
        dif = m - start_m
        base_rate = 0.15
        base_rate = 0.5
        rate = 0
        if dif < 1:
            rate = base_rate
        elif dif <= 5:
            rate = base_rate - dif * 0.01
            rate = base_rate - dif * 0.02
        elif dif <= 120:
            # 11:30之前
            rate = 0.0985 - (dif - 6) * 0.0015
            rate = 0.39 - (dif - 6) * 0.004
        else:
            rate = 0.0985 - (dif - 89 - 6) * 0.0015
            if rate < -0.15:
                rate = -0.15
            rate = 0.39 - (120 - 6) * 0.004 - (dif - 210 + 1) * 0.004
            if rate < -0.5:
                rate = -0.5
        return round(rate, 4)
    # 纯万手哥影响值(手数》=9000 OR 金额》=500w)
    @classmethod
    def get_big_money_rate(cls, num):
        if num >= 8:
            return 0.08
        if num >= 10:
            return 0.5
        else:
            return num * 0.01
            return round(num * 0.05, 2)
    @classmethod
    def compute_rate(cls, zyltgb, total_industry_limit_percent, volumn_day60_max, volumn_yest, volumn_today,
@@ -135,11 +135,14 @@
    def compute_m_value(cls, code):
        zyltgb = global_util.zyltgb_map.get(code)
        if zyltgb is None:
            print("没有获取到自由流通市值")
            return 10000000
            global_util.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)
        print("m值获取:", code, round(zyltgb * rate))
        # print("m值获取:", code, round(zyltgb * rate))
        return round(zyltgb * rate)
@@ -160,6 +163,6 @@
if __name__ == "__main__":
    print(L2TradeFactorUtil.get_big_money_rate(32))
    print(L2TradeFactorUtil.get_big_money_rate(8))
    print(L2TradeFactorUtil.get_big_money_rate(0))
    print(L2TradeFactorUtil.get_big_money_rate(1))
    print(L2TradeFactorUtil.get_big_money_rate(2))
    print(L2TradeFactorUtil.get_big_money_rate(3))