| | |
| | | |
| | | # 设置收盘价 |
| | | import decimal |
| | | |
| | |
| | | from utils import tool |
| | | |
| | | |
| | | def re_set_price_pre(code): |
| | | def re_set_price_pre(code, force=False): |
| | | codes = [code] |
| | | re_set_price_pres(codes) |
| | | re_set_price_pres(codes, force=force) |
| | | |
| | | |
| | | def re_set_price_pres(codes, force=False): |
| | |
| | | symbol = symbol.split(".")[1] |
| | | pre_close = tool.to_price(decimal.Decimal(str(item['pre_close']))) |
| | | gpcode_manager.CodePrePriceManager.set_price_pre(symbol, pre_close, force) |
| | | |
| | | |
| | | # 获取近90天的最大量与最近的量 |
| | | # 获取最近一次涨停/涨停下一个交易日的最大值 |
| | |
| | | |
| | | |
| | | # 解析最大量 |
| | | def parse_max_volume(datas, is_new_top=False): |
| | | def parse_max_volume(datas, is_new_or_near_top=False): |
| | | max_volume = 0 |
| | | |
| | | max_volume_date = None |
| | | if is_new_top: |
| | | # 判断30天内是否有涨停 |
| | | if is_new_or_near_top: |
| | | # 30天内是否有涨停 |
| | | latest_limit_up_index = None |
| | | for i in range(30): |
| | | if i >= len(datas): |
| | | break |
| | | item = datas[i] |
| | | limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"])) |
| | | if abs(limit_up_price - item["high"]) < 0.001: |
| | | latest_limit_up_index = i |
| | | 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"]: |
| | | 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: |
| | | return datas[latest_limit_up_index]["volume"], datas[latest_limit_up_index]["volume"], \ |
| | | datas[latest_limit_up_index]['bob'].strftime("%Y-%m-%d") |
| | | |
| | | if is_new_or_near_top: |
| | | # 如果是突破前高就取最大量 |
| | | for item in datas: |
| | | if max_volume < item["volume"]: |
| | |
| | | max_volume_date = item["bob"] |
| | | return max_volume, max_volume, max_volume_date.strftime("%Y-%m-%d") |
| | | else: |
| | | |
| | | date = None |
| | | target_volume = None |
| | | for i in range(len(datas)): |
| | |
| | | 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") |
| | | |