| | |
| | | F_CANCEL_CACEL_RATE = 0.69 |
| | | |
| | | # G撤单 |
| | | G_CANCEL_RATE = 0.39 |
| | | G_CANCEL_RATE = 0.59 |
| | | # 行情好时的撤单比例 |
| | | G_CANCEL_RATE_FOR_GOOD_MARKET = 0.39 |
| | | G_CANCEL_RATE_FOR_GOOD_MARKET = 0.59 |
| | | |
| | | # 华鑫L2的卡位数量 |
| | | HUAXIN_L2_MAX_CODES_COUNT = 70 |
| | |
| | | if val['orderNo'] == watch_info[1]: |
| | | total_num -= watch_info[2] |
| | | min_index = min(watch_info[0]) |
| | | sell_orders = HuaXinSellOrderStatisticManager.get_latest_transaction_datas(code, total_datas[ |
| | | real_place_order_info[0]]['val'][ |
| | | 'orderNo']) |
| | | # 过滤最小金额 |
| | | zyltgb = l2_trade_factor.L2TradeFactorUtil.get_zyltgb(code) |
| | | zyltgb_unit_y = round(zyltgb / 100000000, 1) |
| | | min_sell_money = int((zyltgb_unit_y / 2 + 5) * 10000) |
| | | sell_orders = HuaXinSellOrderStatisticManager.get_latest_transaction_datas(code, min_sell_order_no= |
| | | total_datas[real_place_order_info[0]]['val']['orderNo'], min_sell_money=min_sell_money) |
| | | sell_order_num = sum([x[1] for x in sell_orders]) // 100 |
| | | rate = round(sell_order_num / total_num, 2) |
| | | if rate > 0.49: |
| | |
| | | else: |
| | | m = x[1] * x[2] |
| | | total_deal_money += m |
| | | if total_deal_money >= 4990000: |
| | | return True, f"1s内大于499w大卖单({total_deal_money})" |
| | | |
| | | zyltgb = l2_trade_factor.L2TradeFactorUtil.get_zyltgb(code) |
| | | zyltgb_unit_y = round(zyltgb / 100000000, 1) |
| | | threshold_big_deal = (2*zyltgb_unit_y + 339)*10000 |
| | | if total_deal_money >= threshold_big_deal: |
| | | return True, f"1s内大于{threshold_big_deal}大卖单({total_deal_money})" |
| | | |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | | # 判断是否为激进下单 |
| | |
| | | |
| | | # 重新设置G撤守护时间 |
| | | def __reset_expire_time(self, code, now_time): |
| | | self.__expire_time_dict[code] = tool.trade_time_add_second(now_time, 15) |
| | | self.__expire_time_dict[code] = tool.trade_time_add_second(now_time, 9) |
| | | |
| | | # 大有单卖 |
| | | # 暂时不启用 |
| | |
| | | if trade_index is None: |
| | | trade_index = 0 |
| | | |
| | | # 下单15s之后才会重新触发 |
| | | # 下单9s之后才会重新触发 |
| | | total_datas = local_today_datas.get(code) |
| | | if tool.trade_time_sub(total_datas[-1]['val']['time'], |
| | | total_datas[real_place_order_info[0]]['val']['time']) <= 15: |
| | | total_datas[real_place_order_info[0]]['val']['time']) <= 9: |
| | | return |
| | | |
| | | # 不重复处理同一卖单号 |
| | |
| | | if buy_single_index is None: |
| | | # ------------------------------确定信号种类---------------------------------- |
| | | # 第一步:获取激进下单信号 |
| | | continue_count = cls.__l2PlaceOrderParamsManagerDict[code].get_begin_continue_buy_count() |
| | | # if code.find('60') == 0: |
| | | # 激进买 |
| | | continue_count = 1 |
| | |
| | | |
| | | # 获取最近成交数据 |
| | | @classmethod |
| | | def get_latest_transaction_datas(cls, code, min_sell_order_no=None, min_deal_time=None): |
| | | def get_latest_transaction_datas(cls, code, min_sell_order_no=None, min_deal_time=None, min_sell_money=None): |
| | | """ |
| | | 获取最近的主动卖成交信息 |
| | | @param code: |
| | | @param min_sell_order_no: |
| | | @param min_deal_time: |
| | | @param min_sell_money: |
| | | @return: |
| | | """ |
| | | total_orders = [] |
| | | sell_orders = cls.__latest_all_sell_orders_dict.get(code) |
| | | if sell_orders: |
| | |
| | | |
| | | if min_sell_order_no and min_sell_order_no > sell_orders[i][0]: |
| | | continue |
| | | if min_sell_money and sell_orders[i][1] * sell_orders[i][2] < min_sell_money: |
| | | # 过滤小金额 |
| | | continue |
| | | |
| | | total_orders.append(sell_orders[i]) |
| | | if code in cls.__latest_sell_order_dict: |
| | | if min_sell_order_no: |
| | |
| | | from l2 import l2_data_util |
| | | from l2.l2_data_manager_new import L2TradeDataProcessor |
| | | from l2.l2_sell_manager import L2MarketSellManager |
| | | |
| | | if __name__ == "__main__": |
| | | codes = ["002194"] |
| | | for code in codes: |
| | | l2_data_util.load_l2_data(code) |
| | | L2MarketSellManager().set_current_total_sell_data(code,"10:20:54",1500000,45612,(8.94,1200)) |
| | | L2TradeDataProcessor.test__compute_active_order_begin_pos(code, 1, 5886, 5896) |
| | | # codes = ["002194"] |
| | | # for code in codes: |
| | | # l2_data_util.load_l2_data(code) |
| | | # L2MarketSellManager().set_current_total_sell_data(code,"10:20:54",1500000,45612,(8.94,1200)) |
| | | # L2TradeDataProcessor.test__compute_active_order_begin_pos(code, 1, 5886, 5896) |
| | | zyltgb = 310*1e8 |
| | | zyltgb_unit_y = round(zyltgb / 100000000, 1) |
| | | threshold_big_deal = (2 * zyltgb_unit_y + 339) * 10000 |
| | | print(threshold_big_deal) |
| | |
| | | from trade import deal_big_money_manager |
| | | from utils import tool |
| | | |
| | | # 缓存L2数据,格式:{"日期":{数据}} |
| | | __l2_data_cache = {} |
| | | |
| | | |
| | | def export_l2_excel(code, date=None): |
| | | # 获取L2的数据 |
| | |
| | | date = tool.get_now_date_str() |
| | | datas = today_datas |
| | | if datas is None: |
| | | local_today_datas = log_export.load_l2_from_log(date) |
| | | if date in __l2_data_cache: |
| | | local_today_datas = __l2_data_cache.get(date) |
| | | else: |
| | | local_today_datas = log_export.load_l2_from_log(date) |
| | | __l2_data_cache[code] = local_today_datas |
| | | datas = local_today_datas.get(code) |
| | | if not datas: |
| | | datas = [] |