6天长得过高/L2不过滤1手的数据/处理L2数据时间与本地时间相差过大的问题
| | |
| | | datas = copy.deepcopy(record_datas) |
| | | datas.sort(key=lambda x: x["bob"]) |
| | | datas = datas[0 - day_count:] |
| | | min_price = None |
| | | max_price = None |
| | | min_price_info = None |
| | | max_price_info = None |
| | | for d in datas: |
| | | if min_price is None: |
| | | min_price = d["low"] |
| | | if max_price is None: |
| | | max_price = d["high"] |
| | | if min_price > d["low"]: |
| | | min_price = d["low"] |
| | | if max_price < d["high"]: |
| | | max_price = d["high"] |
| | | if min_price_info is None: |
| | | min_price_info = d["low"], d |
| | | if max_price_info is None: |
| | | max_price_info = d["high"], d |
| | | if min_price_info[0] > d["low"]: |
| | | min_price_info = d["low"], d |
| | | if max_price_info[0] < d["high"]: |
| | | max_price_info = d["high"], d |
| | | # if max_price > float(limit_up_price): |
| | | # return False |
| | | rate = (float(limit_up_price) - min_price) / min_price |
| | | # print(rate) |
| | | if rate >= 0.319: |
| | | return True |
| | | return False |
| | | rate = (float(limit_up_price) - min_price_info[1]["close"]) / min_price_info[1]["close"] |
| | | print(rate) |
| | | if rate >= 0.28: |
| | | return True, rate |
| | | return False, rate |
| | | |
| | | |
| | | # 连续涨停后是否回调不足够 |
| | |
| | | for x in max_limit_up_continue_count_info_list: |
| | | if max_limit_up_info is None: |
| | | max_limit_up_info = x |
| | | if max_limit_up_info[0] <= x[0]: |
| | | if max_limit_up_info[0] <= x[0]: |
| | | max_limit_up_info = x |
| | | |
| | | if not max_limit_up_info or max_limit_up_info[0] < 3: |
| | |
| | | if item["high"] > max_price_info[0]: |
| | | max_price_info = [item["high"], i] |
| | | # 计算回踩价格 |
| | | lowest_price_threhhold = round((1-0.28) * max_price_info[0], 2) |
| | | lowest_price_threhhold = round((1 - 0.28) * max_price_info[0], 2) |
| | | for i in range(max_price_info[1] + 1, len(datas)): |
| | | item = datas[i] |
| | | if item["low"] < lowest_price_threhhold: |
| | |
| | | l2_trade_util.forbidden_trade(code, |
| | | f"无辨识度,涨停价({limit_up_price})>50") |
| | | continue |
| | | if code_nature_analyse.is_price_too_high_in_days(volumes_data, limit_up_price): |
| | | if code_nature_analyse.is_price_too_high_in_days(volumes_data, limit_up_price)[0]: |
| | | # 判断是否太高 |
| | | # l2_trade_util.forbidden_trade(code, "6天内股价长得太高") |
| | | # continue |
| | | l2_trade_util.forbidden_trade(code, "6天内股价长得太高") |
| | | continue |
| | | pass |
| | | |
| | | if code_nature_analyse.is_continue_limit_up_not_enough_fall_dwon(volumes_data): |
| | |
| | | |
| | | # 过滤订单 |
| | | def __filter_order(self, item): |
| | | if item[2] == 100: |
| | | return item |
| | | filter_condition = self.filter_order_condition_dict.get(item[0]) |
| | | if filter_condition: |
| | | # item[2]为量 |
| | |
| | | last_index = None |
| | | count = 0 |
| | | start = None |
| | | now_time_s = tool.get_time_as_second(tool.get_now_time_str()) |
| | | # now_time_s = tool.get_time_as_second(tool.get_now_time_str()) |
| | | for i in range(start_index, end_index + 1): |
| | | _val = datas[i]["val"] |
| | | time_s = L2DataUtil.get_time_as_second(_val["time"]) |
| | |
| | | if time_s < second_930: |
| | | continue |
| | | |
| | | if not constant.TEST: |
| | | if abs(now_time_s - time_s) > 2: |
| | | # 正式环境下不处理2s外的数据 |
| | | continue |
| | | # if not constant.TEST: |
| | | # if abs(now_time_s - time_s) > 2: |
| | | # # 正式环境下不处理2s外的数据 |
| | | # continue |
| | | |
| | | if L2DataUtil.is_limit_up_price_buy(_val): |
| | | # 金额要大于50万 |
| | |
| | | from utils import init_data_util, tool |
| | | |
| | | |
| | | def is_too_high(datas): |
| | | limit_up_price = round(datas[0]["close"] * 1.1, 2) |
| | | datas.reverse() |
| | | is_new_high = code_nature_analyse.is_up_too_high_from_latest_limit_up(datas) |
| | | return is_new_high |
| | | def is_too_high(): |
| | | codes_str = "000001,000099,000151,000514,000565,000572,000608,000622,000626,000678,000679,000691,000702,000757,000820,000836,000838,000929,000957,000982,001300,001317,001387,002072,002098,002141,002161,002173,002192,002207,002211,002217,002298,002308,002312,002494,002496,002513,002529,002530,002571,002575,002591,002620,002622,002633,002652,002661,002691,002775,002789,002798,002811,002813,002822,002842,002853,002856,002862,002952,002997,003011,003015,300032,300117,300152,300157,300380,300530,300635,300780,300921,300935,301068,301072,301107,301508,600083,600099,600107,600132,600148,600149,600165,600172,600178,600192,600199,600241,600266,600281,600302,600321,600421,600444,600449,600561,600565,600678,600696,600702,600847,601068,601236,601689,603011,603021,603023,603040,603048,603090,603109,603111,603121,603135,603178,603269,603272,603286,603316,603326,603335,603345,603360,603377,603378,603388,603389,603655,603709,603755,603776,603801,603828,603838,603843,603879,603898,603917,603978,605001,605069,605100,605117,605378" |
| | | codes = codes_str.split(",") |
| | | codes.reverse() |
| | | fresults = [] |
| | | for code in codes: |
| | | try: |
| | | volumes_data = init_data_util.get_volumns_by_code(code, 150) |
| | | limit_up_price = round(volumes_data[0]["close"] * 1.1, 2) |
| | | print(code) |
| | | is_too_high, rate = code_nature_analyse.is_price_too_high_in_days(volumes_data, limit_up_price) |
| | | # print(code, is_too_high) |
| | | fresults.append((code, rate)) |
| | | except: |
| | | pass |
| | | fresults.sort(key=lambda x: x[1], reverse=True) |
| | | for f in fresults: |
| | | print(f) |
| | | |
| | | |
| | | def __get_refer_volume_info(): |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | __get_refer_volume_info() |
| | | is_too_high() |
| | | # code = "601022" |
| | | # volumes_data = init_data_util.get_volumns_by_code(code, 150) |
| | | # volumes_data = volumes_data[0:] |
| | |
| | | self.send_response({"code": 1, "msg": str(e)}, client_id, request_id) |
| | | elif ctype == "get_delegated_buy_code_infos": |
| | | # 获取委托中的代码 |
| | | current_delegates = huaxin_trade_record_manager.DelegateRecordManager().list_current_delegates() |
| | | # current_delegates = huaxin_trade_record_manager.DelegateRecordManager().list_current_delegates() |
| | | current_delegates, update_time = huaxin_trade_record_manager.DelegateRecordManager.list_by_day( |
| | | tool.get_now_date_str("%Y%m%d"), None, |
| | | [huaxin_util.TORA_TSTP_OST_Accepted, huaxin_util.TORA_TSTP_OST_PartTraded]) |
| | | fdatas = [] |
| | | if current_delegates: |
| | | for c in current_delegates: |