Administrator
2024-07-17 5bab45ca23dc48aabc8937f0a702ea2c747348ec
策略修改
1个文件已修改
13 ■■■■ 已修改文件
trade/buy_strategy.py 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/buy_strategy.py
@@ -90,14 +90,14 @@
        def can_buy_for_stategy_1():
            # 获取2秒内吃的档数
            rised_price,  msg = self.__get_rised_price(code, info)
            if rised_price < 0.1:
                return False, STRATEGY_TYPE_RISE_HIGH_WITH_BLOCKS, "2S内涨幅小于10档"
            limit_up_price = self.__limit_up_price_dict.get(code)
            threshold_rate_money = round(0.8*float(limit_up_price)/100, 2)
            if rised_price < threshold_rate_money:
                return False, STRATEGY_TYPE_RISE_HIGH_WITH_BLOCKS, f"2S内涨幅小于{int(threshold_rate_money*100)}档"
            pre_close_price = self.__pre_close_price_dict.get(code)
            if pre_close_price is None:
                return False, STRATEGY_TYPE_RISE_HIGH_WITH_BLOCKS, "没有获取到收盘价"
            rate = (info["TradePrice"] - pre_close_price) / pre_close_price
            if rate < 0.07:
                return False, STRATEGY_TYPE_RISE_HIGH_WITH_BLOCKS, "涨幅小于7%"
            if code.find("30") == 0 and rate >= 0.19:
                return True, STRATEGY_TYPE_RISE_HIGH_WITH_BLOCKS, f"2S内上升{int(rised_price * 100)}档({msg})  涨幅({rate})>19% "
            if code.find("30") != 0 and rate >= 0.09:
@@ -166,8 +166,9 @@
                                           l2_huaxin_util.convert_time(start_time, with_ms=True)) <= time_space:
                break
            else:
                # 删除第一个元素
                del self.__latest_transaction_price_dict[code][0]
                if self.__latest_transaction_price_dict[code]:
                    # 删除第一个元素
                    del self.__latest_transaction_price_dict[code][0]
        return self.__latest_transaction_price_dict[code][-1][0] - self.__latest_transaction_price_dict[code][0][0], f"{self.__latest_transaction_price_dict[code]}"