| | |
| | | break |
| | | if latest_limit_up_index is not None: |
| | | # 突破前高或者接近前高,30个交易日内有涨停 |
| | | if latest_limit_up_index > 0 and datas[latest_limit_up_index - 1]["volume"] > datas[latest_limit_up_index]["volume"]: |
| | | if latest_limit_up_index > 0 and datas[latest_limit_up_index - 1]["volume"] > datas[latest_limit_up_index][ |
| | | "volume"]: |
| | | return datas[latest_limit_up_index - 1]["volume"], datas[latest_limit_up_index - 1]["volume"], \ |
| | | datas[latest_limit_up_index - 1]['bob'].strftime("%Y-%m-%d") |
| | | else: |
| | |
| | | max_volume_date = item['bob'] |
| | | # 是否有涨停 |
| | | limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"])) |
| | | if abs(limit_up_price - item["high"]) < 0.01: |
| | | # 不看超过60天的涨停 |
| | | if abs(limit_up_price - item["high"]) < 0.01 and i <= 59: |
| | | # 涨停 |
| | | next_volume = 0 |
| | | if i > 0: |
| | |
| | | date = datas[i - 1]["bob"] |
| | | target_volume = (volume, date) |
| | | break |
| | | |
| | | # 90个交易日无涨停,取最近30天内的最高量作为参考量 |
| | | if not target_volume: |
| | | target_volume = (max_volume, max_volume_date) |
| | | |
| | | # --判断近60天无涨停的最大量 |
| | | max_60_volume_info = [0, None] |
| | | # 60天内是否有涨停 |
| | | has_60_limit_up = False |
| | | for i in range(60): |
| | | if i >= len(datas): |
| | | break |
| | | item = datas[i] |
| | | volume = item["volume"] |
| | | if max_60_volume_info[0] < volume: |
| | | max_60_volume_info = [volume, item["bob"]] |
| | | limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"])) |
| | | if abs(limit_up_price - item["high"]) < 0.01: |
| | | has_60_limit_up = True |
| | | break |
| | | |
| | | if not has_60_limit_up and target_volume[0] > max_60_volume_info[0] * 3: |
| | | # 60天内无涨停,且60天内最大量小于最大量的1/3,判断为地量,返回近60个交易日的最大量 |
| | | return max_60_volume_info[0], max_60_volume_info[0], max_60_volume_info[1].strftime("%Y-%m-%d") |
| | | else: |
| | | return target_volume[0], target_volume[0], target_volume[1].strftime("%Y-%m-%d") |
| | | # --判断近30天无涨停的最大量 |
| | | max_30_volume_info = [0, None] |
| | | for i in range(30): |
| | | if i >= len(datas): |
| | | break |
| | | item = datas[i] |
| | | volume = item["volume"] |
| | | if max_30_volume_info[0] < volume: |
| | | max_30_volume_info = [volume, item["bob"]] |
| | | target_volume = max_30_volume_info |
| | | return target_volume[0], target_volume[0], target_volume[1].strftime("%Y-%m-%d") |