修复模拟盘划转无效:期权页挂载划转脚本,并确保走模拟钱包。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -57,6 +57,12 @@ def install_options_trading(app: Flask, repo_root: str, app_module: Any) -> None
|
|||||||
enabled = _env_bool("OKX_OPTIONS_ENABLED", False)
|
enabled = _env_bool("OKX_OPTIONS_ENABLED", False)
|
||||||
attach_options_templates(app, repo_root)
|
attach_options_templates(app, repo_root)
|
||||||
cfg = _build_cfg(app_module)
|
cfg = _build_cfg(app_module)
|
||||||
|
try:
|
||||||
|
from lib.sim.hooks import patch_options_cfg
|
||||||
|
|
||||||
|
patch_options_cfg(cfg)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
app.extensions["options_cfg"] = cfg
|
app.extensions["options_cfg"] = cfg
|
||||||
register_options_routes(app, cfg)
|
register_options_routes(app, cfg)
|
||||||
_register_options_hub_bridge(app, cfg)
|
_register_options_hub_bridge(app, cfg)
|
||||||
@@ -1751,7 +1757,18 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
|
|||||||
amount = float(data.get("amount"))
|
amount = float(data.get("amount"))
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
return jsonify({"ok": False, "msg": "数量无效"})
|
return jsonify({"ok": False, "msg": "数量无效"})
|
||||||
result = cfg["transfer_ccy"](ex, ccy, amount, from_acct, to_acct)
|
try:
|
||||||
|
import lib.exchange.okx_options_lib as _opt_lib
|
||||||
|
|
||||||
|
xfer = getattr(_opt_lib, "transfer_ccy", None)
|
||||||
|
except Exception:
|
||||||
|
xfer = None
|
||||||
|
if not callable(xfer):
|
||||||
|
xfer = cfg.get("transfer_ccy")
|
||||||
|
result = xfer(ex, ccy, amount, from_acct, to_acct) if callable(xfer) else {
|
||||||
|
"ok": False,
|
||||||
|
"msg": "划转不可用",
|
||||||
|
}
|
||||||
if result.get("ok"):
|
if result.get("ok"):
|
||||||
conn = cfg["get_db"]()
|
conn = cfg["get_db"]()
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -348,6 +348,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% include 'options_page_funds.html' %}
|
{% include 'options_page_funds.html' %}
|
||||||
|
{# embed 期权页不含系统设置面板,须自行挂载划转/兑换脚本 #}
|
||||||
|
{% include 'options_settings_panel.html' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user