feat中控条件单可指令实例账户内划转,Bridge 暴露划转接口。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -400,6 +400,31 @@ def register_hub_bridge_routes(app: Flask, app_module: Any) -> None:
|
||||
out["version"] = 1
|
||||
return jsonify(out)
|
||||
|
||||
@app.route("/api/hub/options/transfer", methods=["POST"])
|
||||
def api_hub_options_transfer():
|
||||
"""中控指令:实例内资金户↔交易户划转(默认资金→交易,USDT)."""
|
||||
if not hub_bridge_token_ok(request.headers):
|
||||
return jsonify({"ok": False, "msg": "未授权", "version": 1}), 401
|
||||
hub_ctx = app.config.get("HUB_CTX") or {}
|
||||
cfg = hub_ctx.get("options_cfg")
|
||||
if not isinstance(cfg, dict):
|
||||
return jsonify({"ok": False, "msg": "期权未就绪", "version": 1}), 503
|
||||
data = request.get_json(silent=True) or {}
|
||||
from lib.options.options_transfer_exec_lib import execute_options_internal_transfer
|
||||
|
||||
out = execute_options_internal_transfer(
|
||||
cfg,
|
||||
amount=data.get("amount"),
|
||||
from_acct=(data.get("from") or "funding"),
|
||||
to_acct=(data.get("to") or "trading"),
|
||||
ccy=(data.get("ccy") or "USDT"),
|
||||
)
|
||||
if not isinstance(out, dict):
|
||||
return jsonify({"ok": False, "msg": "划转返回异常", "version": 1}), 500
|
||||
body = dict(out)
|
||||
body["version"] = 1
|
||||
return jsonify(body)
|
||||
|
||||
@app.route("/api/hub/options/cond_orders", methods=["GET"])
|
||||
def api_hub_options_cond_orders_list():
|
||||
if not hub_bridge_token_ok(request.headers):
|
||||
|
||||
Reference in New Issue
Block a user