单笔期权默认改为币本位;未配置时按coin处理
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -146,7 +146,7 @@ def trading_account_label(
|
||||
|
||||
mode = normalize_options_margin_mode(margin_mode)
|
||||
except Exception:
|
||||
mode = str(margin_mode or "usdc").strip().lower() or "usdc"
|
||||
mode = str(margin_mode or "coin").strip().lower() or "coin"
|
||||
if mode != "coin":
|
||||
if usdt is None:
|
||||
return "—"
|
||||
|
||||
@@ -112,7 +112,7 @@ def register_instance_settings_routes(
|
||||
from lib.options.options_spot_bridge_lib import mode_switch_block_msg
|
||||
|
||||
lines = read_env_lines(env_path)
|
||||
old_mode = normalize_options_margin_mode(env_get(lines, "OKX_OPTIONS_MARGIN_MODE") or "usdc")
|
||||
old_mode = normalize_options_margin_mode(env_get(lines, "OKX_OPTIONS_MARGIN_MODE") or "coin")
|
||||
new_mode = normalize_options_margin_mode(clean.get("OKX_OPTIONS_MARGIN_MODE"))
|
||||
if old_mode != new_mode:
|
||||
conn_m = get_db()
|
||||
|
||||
@@ -1143,7 +1143,7 @@ function formatOptionsFundingLabel(usdc, usdt, eth, marginMode, underly) {
|
||||
return `${n.toFixed(2)} USDC`;
|
||||
}
|
||||
function formatTradingAccountLabel(usdt, eth, btc, marginMode) {
|
||||
const mode = String(marginMode || "usdc").toLowerCase();
|
||||
const mode = String(marginMode || "coin").toLowerCase();
|
||||
if (mode !== "coin") {
|
||||
if (usdt === null || usdt === undefined || usdt === "") return "—";
|
||||
const n = Number(usdt);
|
||||
@@ -1203,7 +1203,7 @@ function accountSnapshotFundingMissing(data){
|
||||
let accountSnapshotRetryCount = 0;
|
||||
function applyAccountSnapshot(data){
|
||||
if(!data || typeof data !== "object") return;
|
||||
const coinMode = String(data.options_margin_mode || "usdc").toLowerCase() === "coin";
|
||||
const coinMode = String(data.options_margin_mode || "coin").toLowerCase() === "coin";
|
||||
if(typeof data.show_perp_funds !== "undefined"){
|
||||
applyPerpFundsVisibility(data.show_perp_funds !== false || coinMode);
|
||||
} else if (coinMode) {
|
||||
|
||||
@@ -1624,7 +1624,7 @@ function formatOptionsFundingLabel(usdc, usdt, eth, marginMode, underly) {
|
||||
return `${n.toFixed(2)} USDC`;
|
||||
}
|
||||
function formatTradingAccountLabel(usdt, eth, btc, marginMode) {
|
||||
const mode = String(marginMode || "usdc").toLowerCase();
|
||||
const mode = String(marginMode || "coin").toLowerCase();
|
||||
if (mode !== "coin") {
|
||||
if (usdt == null || usdt === "") return "—";
|
||||
const n = Number(usdt);
|
||||
@@ -1684,7 +1684,7 @@ function accountSnapshotFundingMissing(data){
|
||||
let accountSnapshotRetryCount = 0;
|
||||
function applyAccountSnapshot(data){
|
||||
if(!data || typeof data !== "object") return;
|
||||
const coinMode = String(data.options_margin_mode || "usdc").toLowerCase() === "coin";
|
||||
const coinMode = String(data.options_margin_mode || "coin").toLowerCase() === "coin";
|
||||
if(typeof data.show_perp_funds !== "undefined"){
|
||||
applyPerpFundsVisibility(data.show_perp_funds !== false || coinMode);
|
||||
} else if (coinMode) {
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
{% include 'instance_header_stats.html' %}
|
||||
</div>
|
||||
<div class="instance-header-phone-strip instance-phone-only" aria-label="手机资金摘要">
|
||||
{% set _coin_margin = (options_margin_mode|default('usdc')) == 'coin' %}
|
||||
{% set _coin_margin = (options_margin_mode|default('coin')) == 'coin' %}
|
||||
{% set _show_perp = (show_perp_funds|default(true)) or _coin_margin %}
|
||||
<span class="inst-phone-chip"{% if not _show_perp %} style="display:none"{% endif %} data-perp-funds="1">
|
||||
<em>交易</em>
|
||||
<b data-funds-field="current-capital">{{ trading_account_label(current_capital, options_trading_eth, options_trading_btc, margin_mode=options_margin_mode|default('usdc')) }}</b>
|
||||
<b data-funds-field="current-capital">{{ trading_account_label(current_capital, options_trading_eth, options_trading_btc, margin_mode=options_margin_mode|default('coin')) }}</b>
|
||||
</span>
|
||||
<span class="inst-phone-chip"{% if not _show_perp %} style="display:none"{% endif %} data-perp-funds="1">
|
||||
<em>资金</em>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{# 资金与统计条(顶栏 / 系统设置共用,单行展示) #}
|
||||
{% set _coin_margin = (options_margin_mode|default('usdc')) == 'coin' %}
|
||||
{% set _coin_margin = (options_margin_mode|default('coin')) == 'coin' %}
|
||||
{% set _show_perp = (show_perp_funds|default(true)) or _coin_margin %}
|
||||
<div class="instance-header-stats{% if options_enabled %} instance-header-stats--options{% endif %}">
|
||||
<div class="stat-strip-item stat-strip-item--primary">
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
<div class="stat-strip-item"{% if not _show_perp %} style="display:none"{% endif %} data-perp-funds="1">
|
||||
<div class="label">交易账户</div>
|
||||
<div class="value" id="current-capital" data-funds-field="current-capital">{{ trading_account_label(current_capital, options_trading_eth, options_trading_btc, margin_mode=options_margin_mode|default('usdc')) }}</div>
|
||||
<div class="value" id="current-capital" data-funds-field="current-capital">{{ trading_account_label(current_capital, options_trading_eth, options_trading_btc, margin_mode=options_margin_mode|default('coin')) }}</div>
|
||||
</div>
|
||||
{% if options_enabled and not _coin_margin %}
|
||||
<div class="stat-strip-item" data-options-funds="1">
|
||||
|
||||
Reference in New Issue
Block a user