| | |
| | | list_ = [level1_data_dict[k] for k in level1_data_dict] |
| | | flist = [] |
| | | now_time_int = int(tool.get_now_time_str().replace(":", "")) |
| | | threshold_rate = constant.L1_MIN_RATE_PRE if now_time_int < int( |
| | | "094000") else constant.L1_MIN_RATE |
| | | threshold_rate = constant.L1_MIN_RATE |
| | | for d in list_: |
| | | if d[2] >= threshold_rate or d[0] in fixed_codes: |
| | | # 涨幅小于5%的需要删除 |
| | | # 涨幅小于3%的需要删除 |
| | | flist.append(d) |
| | | flist.sort(key=lambda x: x[2], reverse=True) |
| | | # 将固定代码的排在最前 |
| | |
| | | if len(datas) > 0: |
| | | logger_l2_codes_subscript.info("开始#华鑫L1上传代码:数量-{}", len(datas)) |
| | | __upload_codes_info(queue_l1_w_strategy_r, datas) |
| | | |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | logger_debug.exception(e) |
| | |
| | | |
| | | q: collections.deque = self.temp_order_queue_dict.get(code) |
| | | if q is not None: |
| | | q.append((data['SecurityID'], data['Price'], data['Volume'], data['Side'], data['OrderType'], data['OrderTime'], |
| | | data['MainSeq'], data['SubSeq'], data['OrderNO'], data['OrderStatus'], time.time(), start_time)) |
| | | q.append( |
| | | (data['SecurityID'], data['Price'], data['Volume'], data['Side'], data['OrderType'], data['OrderTime'], |
| | | data['MainSeq'], data['SubSeq'], data['OrderNO'], data['OrderStatus'], time.time(), start_time)) |
| | | |
| | | # 添加逐笔成交 |
| | | def add_transaction_detail(self, data): |
| | |
| | | if q is not None: |
| | | q.append((data['SecurityID'], data['TradePrice'], data['TradeVolume'], |
| | | data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'], |
| | | data['SellNo'], data['ExecType'])) |
| | | data['SellNo'], data['ExecType'], time.time())) |
| | | |
| | | def add_market_data(self, data): |
| | | # 加入上传队列 |
| | |
| | | try: |
| | | volume = tool.get_buy_volume_by_money(limit_up_price, constant.AVAILABLE_BUY_MONEYS[0]) |
| | | result = huaxin_trade_api.order(huaxin_trade_api.TRADE_DIRECTION_BUY, code, volume, limit_up_price, |
| | | bolcking=False, |
| | | blocking=False, |
| | | shadow_price=shadow_price, shadow_volume=volume) |
| | | async_log_util.info(logger_trade, f"{code}下单结束:{result}") |
| | | buy_open_limit_up_strategy.BuyOpenLimitupDataManager().set_place_order_info(code, volume, volume, |
| | |
| | | _code_list = [] |
| | | _delete_list = [] |
| | | temp_prices = [] |
| | | now_time_int = tool.get_now_time_as_int() |
| | | for d in prices: |
| | | code, price = d["code"], float(d["price"]) |
| | | temp_prices.append((code, price)) |
| | |
| | | if pricePre is not None: |
| | | # 是否是想买单 |
| | | order_index = __compute_code_order(code, top_in_blocks, yesterday_limit_up_codes, today_history_limit_up_codes) |
| | | |
| | | rate = round((price - pricePre) * 100 / pricePre, 2) |
| | | if tool.is_ge_code(code): |
| | | # 创业板的涨幅需要打折 |
| | | rate = rate / 2 |
| | | if order_index >= 0: |
| | | _code_list.append((rate, code, order_index)) |
| | | if now_time_int < 150000: |
| | | if order_index < 1000: |
| | | # 10点之前只订阅有效代码 |
| | | _code_list.append((rate, code, order_index)) |
| | | else: |
| | | _delete_list.append((rate, code, 0)) |
| | | else: |
| | | # 10点之后常规订阅 |
| | | _code_list.append((rate, code, order_index)) |
| | | else: |
| | | # 暂存涨幅为负的代码 |
| | | _delete_list.append((rate, code, 0)) |