| | |
| | | except: |
| | | return [] |
| | | |
| | | def queryPositionBySymbol(self, symbol): |
| | | """ |
| | | 持仓查询 |
| | | :return: |
| | | """ |
| | | try: |
| | | return self.context.account().position(symbol, PositionSide_Long) |
| | | except: |
| | | return [] |
| | | |
| | | def queryUnfinishOrders(self): |
| | | """ |
| | | 查询未完成委托 |
| | |
| | | """ |
| | | async_log_util.info(logger_trade, f"撤单:{local_id}-{account_id}") |
| | | return order_cancel([{"cl_ord_id": local_id, "account_id": account_id}]) |
| | | |
| | | def getExecutionReports(self): |
| | | """ |
| | | 获取执行回报 |
| | | :return: |
| | | """ |
| | | return get_execution_reports() |
| | | |
| | | |
| | | __JueJinTradeManager = JueJinTradeManager() |
| | |
| | | elif type == 'position': |
| | | results = __JueJinTradeManager.queryPosition() |
| | | __send_request_response(request_id, results) |
| | | elif type == 'get_position_by_symbol': |
| | | results = __JueJinTradeManager.queryPositionBySymbol(data["symbol"]) |
| | | __send_request_response(request_id, results) |
| | | elif type == 'get_unfinish_orders': |
| | | results = __JueJinTradeManager.queryUnfinishOrders() |
| | | __send_request_response(request_id, results) |
| | | elif type == 'cancel_order': |
| | | __JueJinTradeManager.cancelOrders(data["local_order_id"], data["account_id"]) |
| | | __send_request_response(request_id, {}) |
| | | elif type == 'get_execution_reports': |
| | | __JueJinTradeManager.getExecutionReports() |
| | | __send_request_response(request_id, {}) |
| | | |
| | | |
| | | |
| | | |
| | | except Exception as e: |
| | | logger_print.exception(e) |
| | | |