| | |
| | | |
| | | import constant |
| | | import gpcode_manager |
| | | import l2_data_log |
| | | from l2 import l2_data_log |
| | | import log |
| | | from db import redis_manager |
| | | import tool |
| | |
| | | datas = L2DataUtil.format_l2_data(data, code, limit_up_price) |
| | | # 获取涨停价 |
| | | return day, client, channel, code, capture_time, process_time, datas, data |
| | | |
| | | |
| | | # 是否为大单 |
| | | def is_big_money(val): |
| | | price = float(val["price"]) |
| | | money = price * int(val["num"]) |
| | | if price > 3.0: |
| | | if money >= 30000: |
| | | return True |
| | | else: |
| | | return False |
| | | else: |
| | | max_money = price * 10000 |
| | | if money >= max_money * 0.95: |
| | | return True |
| | | else: |
| | | return False |
| | | |
| | | |
| | | class L2DataUtil: |
| | |
| | | class L2TradeQueueUtils(object): |
| | | # 获取成交进度索引 |
| | | @classmethod |
| | | def find_traded_progress_index(cls, buy_1_price, total_datas, local_today_num_operate_map, queueList, |
| | | def find_traded_progress_index(cls, buy_1_price, total_datas, local_today_num_operate_map, queueList,last_index, |
| | | latest_not_limit_up_time=None): |
| | | if len(queueList) == 0: |
| | | return None |
| | |
| | | # 在最近一次非涨停买1更新的时间之后才有效 |
| | | if latest_not_limit_up_time is None or tool.trade_time_sub(data["val"]["time"], |
| | | latest_not_limit_up_time) >= 0: |
| | | index_set.add(data["index"]) |
| | | if data["index"]>=last_index: |
| | | index_set.add(data["index"]) |
| | | index_list = list(index_set) |
| | | index_list.sort() |
| | | num_list = [] |
| | |
| | | temp_str = index_list_str[0:find_index] |
| | | if temp_str.endswith(","): |
| | | temp_str = temp_str[:-1] |
| | | |
| | | if temp_str == "": |
| | | return new_index_list[0] |
| | | return new_index_list[len(temp_str.split(","))] |
| | | raise Exception("尚未找到成交进度") |
| | | |