| | |
| | | self.l2_data_upload_manager.add_l2_order_detail(item, 0) |
| | | |
| | | def OnRtnNGTSTick(self, pTick): |
| | | # logger_debug.info(f"OnRtnNGTSTick: {pTick}") |
| | | logger_debug.info(f"OnRtnNGTSTick: {pTick}") |
| | | # 输出逐笔成交数据 |
| | | try: |
| | | if pTick['TickType'] == b'T': |
| | |
| | | huaxin_trade_record_manager.PositionManager.cache(datas) |
| | | # 获取持仓股的涨停价 |
| | | position_codes = set() |
| | | # TODO 测试 |
| | | position_codes.add("113565") |
| | | need_update_codes = [] |
| | | for d in datas: |
| | | if d["prePosition"] > 0 and tool.is_can_sell_code(d["securityID"]): |
| | |
| | | if not current_price: |
| | | raise Exception("尚未获取到现价") |
| | | price = round(tool.get_buy_max_price(current_price), 3) |
| | | result = huaxin_trade_api.order(1, code, volume, price, blocking=True, order_ref=order_ref) |
| | | sinfo = f"b_{code}_{int(time.time()*1000)}" |
| | | # 需要立即卖的数据 |
| | | # 下单之后需要立即卖出 |
| | | cb_data_util.need_sell_sinfos.add(sinfo) |
| | | result = huaxin_trade_api.order(1, code, volume, price, blocking=True, order_ref=order_ref, sinfo = sinfo) |
| | | if result: |
| | | if result["code"] == 0: |
| | | sinfo = result["data"]["sinfo"] |
| | | # 需要立即卖的数据 |
| | | cb_data_util.need_sell_sinfos.add(sinfo) |
| | | pass |
| | | # 记录当前的sinfo |
| | | async_log_util.info(logger_trade, f"API可转债买结果: {result}") |
| | | self.send_response(result, client_id, request_id) |