def cancle_order(cancle_req: CancelRequest): """撤单""" app = current_app if not app.config.get("TD_FUNC"): raise TraderError(message="交易功能未开启", args=("交易功能未开启",)) cancle_monitor.send(cancle_req) app.trader.cancel_order(cancle_req)
def send_order(order_req: OrderRequest): """发单""" app = current_app if not app.config.get("TD_FUNC"): raise TraderError(message="交易功能未开启", args=("交易功能未开启",)) send_monitor.send(order_req) return app.trader.send_order(order_req)
def query_func(type: Text) -> None: """查询持仓 or 账户""" app = current_app if not app.config.get("TD_FUNC"): raise TraderError(message="交易功能未开启", args=("交易功能未开启",)) if type == "position": app.trader.query_position() if type == "account": app.trader.query_account()
def cancel_order(cancel_req: CancelRequest, app_name: str = "current_app"): """ 撤单 """ if app_name == "current_app": app = current_app else: app = get_app(app_name) if not app.config.get("TD_FUNC"): raise TraderError(message="交易功能未开启", args=("交易功能未开启", )) cancel_monitor.send(cancel_req) app.trader.cancel_order(cancel_req)
def send_order(order_req: OrderRequest, app_name: str = "current_app"): """ 发单 """ if app_name == "current_app": app = current_app else: app = get_app(app_name) if not app.config.get("TD_FUNC"): raise TraderError(message="交易功能未开启", args=("交易功能未开启", )) send_monitor.send(order_req) return app.trader.send_order(order_req)
def query_func(type: Text, app_name: str = "current_app") -> None: """ 查询持仓或者账户 """ if app_name == "current_app": app = current_app else: app = get_app(app_name) if not app.config.get("TD_FUNC"): raise TraderError(message="交易功能未开启", args=("交易功能未开启", )) if type == "position": app.trader.query_position() if type == "account": app.trader.query_account()