feat: single-row funds strip on header and system settings page
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6494,6 +6494,7 @@ def render_main_page(page="trade", embed_mode=None):
|
|||||||
from lib.instance.instance_embed_context_lib import (
|
from lib.instance.instance_embed_context_lib import (
|
||||||
embed_render_plan,
|
embed_render_plan,
|
||||||
minimal_stats_bundle,
|
minimal_stats_bundle,
|
||||||
|
options_funding_label,
|
||||||
profit_loss_ratio_from_trades,
|
profit_loss_ratio_from_trades,
|
||||||
total_funds_usdt,
|
total_funds_usdt,
|
||||||
trade_records_summary,
|
trade_records_summary,
|
||||||
@@ -6508,15 +6509,22 @@ def render_main_page(page="trade", embed_mode=None):
|
|||||||
current_capital = round(trading_capital, FUNDS_DECIMALS) if trading_capital is not None else round(local_current_capital, FUNDS_DECIMALS)
|
current_capital = round(trading_capital, FUNDS_DECIMALS) if trading_capital is not None else round(local_current_capital, FUNDS_DECIMALS)
|
||||||
options_trading_usdc = None
|
options_trading_usdc = None
|
||||||
options_funding_usdc = None
|
options_funding_usdc = None
|
||||||
|
options_funding_usdt = None
|
||||||
if OKX_OPTIONS_ENABLED and exchange_options.apiKey:
|
if OKX_OPTIONS_ENABLED and exchange_options.apiKey:
|
||||||
try:
|
try:
|
||||||
from lib.exchange.okx_options_lib import fetch_options_funding_usdc, fetch_options_trading_usdc
|
from lib.exchange.okx_options_lib import (
|
||||||
|
fetch_options_funding_usdc,
|
||||||
|
fetch_options_funding_usdt,
|
||||||
|
fetch_options_trading_usdc,
|
||||||
|
)
|
||||||
|
|
||||||
options_trading_usdc = fetch_options_trading_usdc(exchange_options)
|
options_trading_usdc = fetch_options_trading_usdc(exchange_options)
|
||||||
options_funding_usdc = fetch_options_funding_usdc(exchange_options)
|
options_funding_usdc = fetch_options_funding_usdc(exchange_options)
|
||||||
|
options_funding_usdt = fetch_options_funding_usdt(exchange_options)
|
||||||
except Exception:
|
except Exception:
|
||||||
options_trading_usdc = None
|
options_trading_usdc = None
|
||||||
options_funding_usdc = None
|
options_funding_usdc = None
|
||||||
|
options_funding_usdt = None
|
||||||
recommended_capital = get_recommended_capital(current_capital)
|
recommended_capital = get_recommended_capital(current_capital)
|
||||||
key_list = (
|
key_list = (
|
||||||
conn.execute("SELECT * FROM key_monitors").fetchall() if plan.key_list else []
|
conn.execute("SELECT * FROM key_monitors").fetchall() if plan.key_list else []
|
||||||
@@ -6635,9 +6643,14 @@ def render_main_page(page="trade", embed_mode=None):
|
|||||||
rate=rate,
|
rate=rate,
|
||||||
profit_loss_ratio=profit_loss_ratio,
|
profit_loss_ratio=profit_loss_ratio,
|
||||||
total_funds=total_funds_usdt(
|
total_funds=total_funds_usdt(
|
||||||
funding_usdt, current_capital, options_trading_usdc, options_funding_usdc
|
funding_usdt,
|
||||||
|
current_capital,
|
||||||
|
options_trading_usdc,
|
||||||
|
options_funding_usdc,
|
||||||
|
options_funding_usdt,
|
||||||
),
|
),
|
||||||
options_funding_usdc=options_funding_usdc,
|
options_funding_usdc=options_funding_usdc,
|
||||||
|
options_funding_usdt=options_funding_usdt,
|
||||||
options_trading_usdc=options_trading_usdc,
|
options_trading_usdc=options_trading_usdc,
|
||||||
trading_day=trading_day,
|
trading_day=trading_day,
|
||||||
daily_start_capital=DAILY_START_CAPITAL,
|
daily_start_capital=DAILY_START_CAPITAL,
|
||||||
@@ -6697,6 +6710,7 @@ def render_main_page(page="trade", embed_mode=None):
|
|||||||
journal_chart_default_anchor=JOURNAL_CHART_DEFAULT_ANCHOR,
|
journal_chart_default_anchor=JOURNAL_CHART_DEFAULT_ANCHOR,
|
||||||
key_rule_ctx=key_rule_ctx,
|
key_rule_ctx=key_rule_ctx,
|
||||||
funds_fmt=format_funds_u,
|
funds_fmt=format_funds_u,
|
||||||
|
options_funding_label=options_funding_label,
|
||||||
exchange_display=EXCHANGE_DISPLAY_NAME,
|
exchange_display=EXCHANGE_DISPLAY_NAME,
|
||||||
options_enabled=OKX_OPTIONS_ENABLED,
|
options_enabled=OKX_OPTIONS_ENABLED,
|
||||||
options_nav_visible=True,
|
options_nav_visible=True,
|
||||||
@@ -6800,15 +6814,22 @@ def api_account_snapshot():
|
|||||||
current_capital = round(trading_capital, FUNDS_DECIMALS) if trading_capital is not None else round(local_current_capital, FUNDS_DECIMALS)
|
current_capital = round(trading_capital, FUNDS_DECIMALS) if trading_capital is not None else round(local_current_capital, FUNDS_DECIMALS)
|
||||||
options_trading_usdc = None
|
options_trading_usdc = None
|
||||||
options_funding_usdc = None
|
options_funding_usdc = None
|
||||||
|
options_funding_usdt = None
|
||||||
if OKX_OPTIONS_ENABLED and exchange_options.apiKey:
|
if OKX_OPTIONS_ENABLED and exchange_options.apiKey:
|
||||||
try:
|
try:
|
||||||
from lib.exchange.okx_options_lib import fetch_options_funding_usdc, fetch_options_trading_usdc
|
from lib.exchange.okx_options_lib import (
|
||||||
|
fetch_options_funding_usdc,
|
||||||
|
fetch_options_funding_usdt,
|
||||||
|
fetch_options_trading_usdc,
|
||||||
|
)
|
||||||
|
|
||||||
options_trading_usdc = fetch_options_trading_usdc(exchange_options)
|
options_trading_usdc = fetch_options_trading_usdc(exchange_options)
|
||||||
options_funding_usdc = fetch_options_funding_usdc(exchange_options)
|
options_funding_usdc = fetch_options_funding_usdc(exchange_options)
|
||||||
|
options_funding_usdt = fetch_options_funding_usdt(exchange_options)
|
||||||
except Exception:
|
except Exception:
|
||||||
options_trading_usdc = None
|
options_trading_usdc = None
|
||||||
options_funding_usdc = None
|
options_funding_usdc = None
|
||||||
|
options_funding_usdt = None
|
||||||
recommended_capital = get_recommended_capital(current_capital)
|
recommended_capital = get_recommended_capital(current_capital)
|
||||||
from lib.strategy.strategy_trade_labels import count_position_limit_active_monitors
|
from lib.strategy.strategy_trade_labels import count_position_limit_active_monitors
|
||||||
|
|
||||||
@@ -6852,9 +6873,14 @@ def api_account_snapshot():
|
|||||||
"funding_usdt": funding_usdt,
|
"funding_usdt": funding_usdt,
|
||||||
"current_capital": current_capital,
|
"current_capital": current_capital,
|
||||||
"options_funding_usdc": options_funding_usdc,
|
"options_funding_usdc": options_funding_usdc,
|
||||||
|
"options_funding_usdt": options_funding_usdt,
|
||||||
"options_trading_usdc": options_trading_usdc,
|
"options_trading_usdc": options_trading_usdc,
|
||||||
"total_funds": total_funds_usdt(
|
"total_funds": total_funds_usdt(
|
||||||
funding_usdt, current_capital, options_trading_usdc, options_funding_usdc
|
funding_usdt,
|
||||||
|
current_capital,
|
||||||
|
options_trading_usdc,
|
||||||
|
options_funding_usdc,
|
||||||
|
options_funding_usdt,
|
||||||
),
|
),
|
||||||
"available_trading_usdt": round(available_trading_usdt, FUNDS_DECIMALS) if available_trading_usdt is not None else None,
|
"available_trading_usdt": round(available_trading_usdt, FUNDS_DECIMALS) if available_trading_usdt is not None else None,
|
||||||
"unrealized_pnl": unrealized_pnl,
|
"unrealized_pnl": unrealized_pnl,
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.instance-header-stats {
|
.instance-header-stats {
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
flex-wrap: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-strip-inner {
|
.stat-strip-inner {
|
||||||
@@ -602,15 +602,25 @@ html[data-theme="light"] .theme-toggle-btn.is-active {
|
|||||||
font-size: 0.82rem;
|
font-size: 0.82rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.instance-header-stats {
|
.instance-header-stats-wrap {
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(9, minmax(0, 1fr));
|
|
||||||
gap: 0;
|
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
padding: 14px 0 12px;
|
padding-top: 12px;
|
||||||
border-top: 1px solid var(--border-soft, #2a3150);
|
border-top: 1px solid var(--border-soft, #2a3150);
|
||||||
min-height: 72px;
|
}
|
||||||
align-items: center;
|
|
||||||
|
.instance-header-stats {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
overflow-x: auto;
|
||||||
|
gap: 0;
|
||||||
|
padding: 2px 0 0;
|
||||||
|
min-height: 56px;
|
||||||
|
align-items: stretch;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
}
|
||||||
|
|
||||||
|
.instance-header-stats--options .stat-strip-item {
|
||||||
|
min-width: 72px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-strip-item {
|
.stat-strip-item {
|
||||||
@@ -618,8 +628,9 @@ html[data-theme="light"] .theme-toggle-btn.is-active {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
min-width: 0;
|
flex: 1 1 0;
|
||||||
padding: 4px 10px;
|
min-width: 64px;
|
||||||
|
padding: 4px 8px;
|
||||||
border-right: 1px solid var(--border-soft, #2a3150);
|
border-right: 1px solid var(--border-soft, #2a3150);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
@@ -641,7 +652,7 @@ html[data-theme="light"] .theme-toggle-btn.is-active {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.stat-strip-item .value {
|
.stat-strip-item .value {
|
||||||
font-size: 0.94rem;
|
font-size: 0.88rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #e8ecff;
|
color: #e8ecff;
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
@@ -653,7 +664,7 @@ html[data-theme="light"] .theme-toggle-btn.is-active {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.stat-strip-item--primary .value {
|
.stat-strip-item--primary .value {
|
||||||
font-size: 1.18rem;
|
font-size: 1.02rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,13 +678,15 @@ html[data-theme="light"] .theme-toggle-btn.is-active {
|
|||||||
|
|
||||||
@media (max-width: 1100px) {
|
@media (max-width: 1100px) {
|
||||||
.instance-header-stats {
|
.instance-header-stats {
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
flex-wrap: nowrap;
|
||||||
row-gap: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-strip-item {
|
.stat-strip-item {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
min-width: 72px;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
|
border-right: 1px solid var(--border-soft, #2a3150);
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-strip-item:first-child {
|
.stat-strip-item:first-child {
|
||||||
@@ -2149,6 +2162,26 @@ html[data-theme="light"] .journal-detail-img-thumb {
|
|||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings-account-summary {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
padding: 12px 14px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-account-summary .instance-header-stats {
|
||||||
|
border-top: none;
|
||||||
|
margin-top: 0;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-account-summary-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
.settings-cards-grid {
|
.settings-cards-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
|
grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
|
||||||
|
|||||||
@@ -497,6 +497,14 @@ def fetch_options_funding_usdc(ex: ccxt.okx) -> float | None:
|
|||||||
return round(float(v), 2)
|
return round(float(v), 2)
|
||||||
|
|
||||||
|
|
||||||
|
def fetch_options_funding_usdt(ex: ccxt.okx) -> float | None:
|
||||||
|
bal = fetch_options_balances(ex)
|
||||||
|
v = bal.get("funding_usdt")
|
||||||
|
if v is None:
|
||||||
|
return None
|
||||||
|
return round(float(v), 2)
|
||||||
|
|
||||||
|
|
||||||
def spot_market_swap_usdt_usdc(
|
def spot_market_swap_usdt_usdc(
|
||||||
ex: ccxt.okx,
|
ex: ccxt.okx,
|
||||||
*,
|
*,
|
||||||
|
|||||||
@@ -85,11 +85,24 @@ def profit_loss_ratio_from_trades(trades: list[dict[str, Any]] | None) -> float
|
|||||||
return profit_loss_ratio_from_averages(avg_win, avg_loss)
|
return profit_loss_ratio_from_averages(avg_win, avg_loss)
|
||||||
|
|
||||||
|
|
||||||
|
def options_funding_label(
|
||||||
|
funding_usdc: float | None,
|
||||||
|
funding_usdt: float | None = None,
|
||||||
|
) -> str:
|
||||||
|
parts: list[str] = []
|
||||||
|
if funding_usdc is not None:
|
||||||
|
parts.append(f"{float(funding_usdc):.2f} USDC")
|
||||||
|
if funding_usdt is not None:
|
||||||
|
parts.append(f"{float(funding_usdt):.2f} USDT")
|
||||||
|
return " · ".join(parts) if parts else "—"
|
||||||
|
|
||||||
|
|
||||||
def total_funds_usdt(
|
def total_funds_usdt(
|
||||||
funding_usdt: float | None,
|
funding_usdt: float | None,
|
||||||
trading_usdt: float | None,
|
trading_usdt: float | None,
|
||||||
options_trading_usdc: float | None = None,
|
options_trading_usdc: float | None = None,
|
||||||
options_funding_usdc: float | None = None,
|
options_funding_usdc: float | None = None,
|
||||||
|
options_funding_usdt: float | None = None,
|
||||||
) -> float | None:
|
) -> float | None:
|
||||||
if funding_usdt is None:
|
if funding_usdt is None:
|
||||||
return None
|
return None
|
||||||
@@ -97,6 +110,8 @@ def total_funds_usdt(
|
|||||||
total = float(funding_usdt) + float(trading_usdt or 0)
|
total = float(funding_usdt) + float(trading_usdt or 0)
|
||||||
if options_funding_usdc is not None:
|
if options_funding_usdc is not None:
|
||||||
total += float(options_funding_usdc)
|
total += float(options_funding_usdc)
|
||||||
|
if options_funding_usdt is not None:
|
||||||
|
total += float(options_funding_usdt)
|
||||||
if options_trading_usdc is not None:
|
if options_trading_usdc is not None:
|
||||||
total += float(options_trading_usdc)
|
total += float(options_trading_usdc)
|
||||||
return round(total, 2)
|
return round(total, 2)
|
||||||
|
|||||||
@@ -1047,6 +1047,13 @@ function sumOrdersFloatPnl(orders){
|
|||||||
return found ? total : null;
|
return found ? total : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatOptionsFundingLabel(usdc, usdt) {
|
||||||
|
const parts = [];
|
||||||
|
if (usdc !== null && usdc !== undefined) parts.push(`${Number(usdc).toFixed(2)} USDC`);
|
||||||
|
if (usdt !== null && usdt !== undefined) parts.push(`${Number(usdt).toFixed(2)} USDT`);
|
||||||
|
return parts.length ? parts.join(" · ") : "—";
|
||||||
|
}
|
||||||
|
|
||||||
function refreshAccountSnapshot(){
|
function refreshAccountSnapshot(){
|
||||||
fetch("/api/account_snapshot").then(r=>r.json()).then(data=>{
|
fetch("/api/account_snapshot").then(r=>r.json()).then(data=>{
|
||||||
if (typeof data.funding_usdt !== "undefined") {
|
if (typeof data.funding_usdt !== "undefined") {
|
||||||
@@ -1061,10 +1068,9 @@ function refreshAccountSnapshot(){
|
|||||||
const el = document.getElementById("current-capital");
|
const el = document.getElementById("current-capital");
|
||||||
if(el) el.innerText = `${Number(data.current_capital).toFixed(2)}U`;
|
if(el) el.innerText = `${Number(data.current_capital).toFixed(2)}U`;
|
||||||
}
|
}
|
||||||
if (typeof data.options_funding_usdc !== "undefined") {
|
if (typeof data.options_funding_usdc !== "undefined" || typeof data.options_funding_usdt !== "undefined") {
|
||||||
const el = document.getElementById("options-funding-usdc");
|
const el = document.getElementById("options-funding-usdc");
|
||||||
if (el) el.innerText = (data.options_funding_usdc === null || data.options_funding_usdc === undefined)
|
if (el) el.innerText = formatOptionsFundingLabel(data.options_funding_usdc, data.options_funding_usdt);
|
||||||
? "—" : `${Number(data.options_funding_usdc).toFixed(2)} USDC`;
|
|
||||||
}
|
}
|
||||||
if (typeof data.options_trading_usdc !== "undefined") {
|
if (typeof data.options_trading_usdc !== "undefined") {
|
||||||
const el = document.getElementById("options-trading-usdc");
|
const el = document.getElementById("options-trading-usdc");
|
||||||
@@ -1179,6 +1185,8 @@ if(window.ManualOrderRrPreview){
|
|||||||
});
|
});
|
||||||
|
|
||||||
refreshAccountSnapshot();
|
refreshAccountSnapshot();
|
||||||
|
const settingsRefreshFunds = document.getElementById("settings-refresh-funds");
|
||||||
|
if (settingsRefreshFunds) settingsRefreshFunds.addEventListener("click", refreshAccountSnapshot);
|
||||||
if (window.AccountRiskBadge) AccountRiskBadge.startTicker();
|
if (window.AccountRiskBadge) AccountRiskBadge.startTicker();
|
||||||
const _journalFormEl = document.getElementById("journal-form");
|
const _journalFormEl = document.getElementById("journal-form");
|
||||||
if(_journalFormEl){
|
if(_journalFormEl){
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<link rel="stylesheet" href="/static/instance_theme_early.css?v=4">
|
<link rel="stylesheet" href="/static/instance_theme_early.css?v=4">
|
||||||
<link rel="stylesheet" href="/static/account_risk_badge.css?v=4">
|
<link rel="stylesheet" href="/static/account_risk_badge.css?v=4">
|
||||||
<link rel="stylesheet" href="/static/instance_page.css?v=3">
|
<link rel="stylesheet" href="/static/instance_page.css?v=3">
|
||||||
<link rel="stylesheet" href="/static/instance_theme.css?v=60">
|
<link rel="stylesheet" href="/static/instance_theme.css?v=62">
|
||||||
<script src="/static/account_risk_badge.js?v=4"></script>
|
<script src="/static/account_risk_badge.js?v=4"></script>
|
||||||
<meta name="theme-color" content="#0b0d14">
|
<meta name="theme-color" content="#0b0d14">
|
||||||
<title>{{ exchange_display }} · 加密货币 | 交易监控复盘系统</title>
|
<title>{{ exchange_display }} · 加密货币 | 交易监控复盘系统</title>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<link rel="manifest" href="/static/icons/manifest.webmanifest">
|
<link rel="manifest" href="/static/icons/manifest.webmanifest">
|
||||||
<title>{{ exchange_display }} · 加密货币 | 交易监控复盘系统</title>
|
<title>{{ exchange_display }} · 加密货币 | 交易监控复盘系统</title>
|
||||||
<link rel="stylesheet" href="/static/instance_page.css?v=1">
|
<link rel="stylesheet" href="/static/instance_page.css?v=1">
|
||||||
<link rel="stylesheet" href="/static/instance_theme.css?v=61">
|
<link rel="stylesheet" href="/static/instance_theme.css?v=62">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body
|
<body
|
||||||
@@ -1598,6 +1598,13 @@ function sumOrdersFloatPnl(orders){
|
|||||||
return found ? total : null;
|
return found ? total : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatOptionsFundingLabel(usdc, usdt) {
|
||||||
|
const parts = [];
|
||||||
|
if (usdc !== null && usdc !== undefined) parts.push(`${Number(usdc).toFixed(2)} USDC`);
|
||||||
|
if (usdt !== null && usdt !== undefined) parts.push(`${Number(usdt).toFixed(2)} USDT`);
|
||||||
|
return parts.length ? parts.join(" · ") : "—";
|
||||||
|
}
|
||||||
|
|
||||||
function refreshAccountSnapshot(){
|
function refreshAccountSnapshot(){
|
||||||
fetch("/api/account_snapshot").then(r=>r.json()).then(data=>{
|
fetch("/api/account_snapshot").then(r=>r.json()).then(data=>{
|
||||||
if (typeof data.funding_usdt !== "undefined") {
|
if (typeof data.funding_usdt !== "undefined") {
|
||||||
@@ -1612,10 +1619,9 @@ function refreshAccountSnapshot(){
|
|||||||
const el = document.getElementById("current-capital");
|
const el = document.getElementById("current-capital");
|
||||||
if(el) el.innerText = `${Number(data.current_capital).toFixed(2)}U`;
|
if(el) el.innerText = `${Number(data.current_capital).toFixed(2)}U`;
|
||||||
}
|
}
|
||||||
if (typeof data.options_funding_usdc !== "undefined") {
|
if (typeof data.options_funding_usdc !== "undefined" || typeof data.options_funding_usdt !== "undefined") {
|
||||||
const el = document.getElementById("options-funding-usdc");
|
const el = document.getElementById("options-funding-usdc");
|
||||||
if (el) el.innerText = (data.options_funding_usdc === null || data.options_funding_usdc === undefined)
|
if (el) el.innerText = formatOptionsFundingLabel(data.options_funding_usdc, data.options_funding_usdt);
|
||||||
? "—" : `${Number(data.options_funding_usdc).toFixed(2)} USDC`;
|
|
||||||
}
|
}
|
||||||
if (typeof data.options_trading_usdc !== "undefined") {
|
if (typeof data.options_trading_usdc !== "undefined") {
|
||||||
const el = document.getElementById("options-trading-usdc");
|
const el = document.getElementById("options-trading-usdc");
|
||||||
@@ -1754,6 +1760,8 @@ if(window.ManualOrderRrPreview){
|
|||||||
});
|
});
|
||||||
|
|
||||||
refreshAccountSnapshot();
|
refreshAccountSnapshot();
|
||||||
|
const settingsRefreshFunds = document.getElementById("settings-refresh-funds");
|
||||||
|
if (settingsRefreshFunds) settingsRefreshFunds.addEventListener("click", refreshAccountSnapshot);
|
||||||
if (window.AccountRiskBadge) AccountRiskBadge.startTicker();
|
if (window.AccountRiskBadge) AccountRiskBadge.startTicker();
|
||||||
const _journalFormEl = document.getElementById("journal-form");
|
const _journalFormEl = document.getElementById("journal-form");
|
||||||
if(_journalFormEl){
|
if(_journalFormEl){
|
||||||
|
|||||||
@@ -41,52 +41,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="instance-header-stats instance-desktop-only">
|
<div class="instance-header-stats-wrap instance-desktop-only">
|
||||||
<div class="stat-strip-item stat-strip-item--primary">
|
{% include 'instance_header_stats.html' %}
|
||||||
<div class="label">交易所</div>
|
|
||||||
<div class="value">{{ exchange_display }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-strip-item">
|
|
||||||
<div class="label">交易日</div>
|
|
||||||
<div class="value">{{ trading_day }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-strip-item stat-strip-item--primary">
|
|
||||||
<div class="label">总交易</div>
|
|
||||||
<div class="value" id="stat-total">{{ total }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-strip-item">
|
|
||||||
<div class="label">胜率</div>
|
|
||||||
<div class="value" id="stat-rate">{{ rate }}%</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-strip-item" title="平均盈利 ÷ 平均亏损(当前列表窗口)">
|
|
||||||
<div class="label">盈亏比</div>
|
|
||||||
<div class="value" id="stat-pl-ratio">{% if profit_loss_ratio is not none %}{{ profit_loss_ratio }}{% else %}—{% endif %}</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-strip-item">
|
|
||||||
<div class="label">总资金</div>
|
|
||||||
<div class="value" id="total-funds">{% if total_funds is not none %}{{ funds_fmt(total_funds) }}U{% else %}—{% endif %}</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-strip-item">
|
|
||||||
<div class="label">资金账户</div>
|
|
||||||
<div class="value" id="total-capital">{% if funding_usdt is not none %}{{ funds_fmt(funding_usdt) }}U{% else %}—{% endif %}</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-strip-item">
|
|
||||||
<div class="label">交易账户</div>
|
|
||||||
<div class="value" id="current-capital">{{ funds_fmt(current_capital) }}U</div>
|
|
||||||
</div>
|
|
||||||
{% if options_enabled %}
|
|
||||||
<div class="stat-strip-item">
|
|
||||||
<div class="label">期权资金账户</div>
|
|
||||||
<div class="value" id="options-funding-usdc">{% if options_funding_usdc is not none %}{{ funds_fmt(options_funding_usdc) }} USDC{% else %}—{% endif %}</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-strip-item">
|
|
||||||
<div class="label">期权交易账户</div>
|
|
||||||
<div class="value" id="options-trading-usdc">{% if options_trading_usdc is not none %}{{ funds_fmt(options_trading_usdc) }} USDC{% else %}—{% endif %}</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="stat-strip-item stat-strip-item--pnl">
|
|
||||||
<div class="label">实时盈亏</div>
|
|
||||||
<div class="value" id="realtime-pnl">—</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
{# 资金与统计条(顶栏 / 系统设置共用,单行展示) #}
|
||||||
|
<div class="instance-header-stats{% if options_enabled %} instance-header-stats--options{% endif %}">
|
||||||
|
<div class="stat-strip-item stat-strip-item--primary">
|
||||||
|
<div class="label">交易所</div>
|
||||||
|
<div class="value">{{ exchange_display }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-strip-item">
|
||||||
|
<div class="label">交易日</div>
|
||||||
|
<div class="value">{{ trading_day }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-strip-item stat-strip-item--primary">
|
||||||
|
<div class="label">总交易</div>
|
||||||
|
<div class="value" id="stat-total">{{ total }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-strip-item">
|
||||||
|
<div class="label">胜率</div>
|
||||||
|
<div class="value" id="stat-rate">{{ rate }}%</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-strip-item" title="平均盈利 ÷ 平均亏损(当前列表窗口)">
|
||||||
|
<div class="label">盈亏比</div>
|
||||||
|
<div class="value" id="stat-pl-ratio">{% if profit_loss_ratio is not none %}{{ profit_loss_ratio }}{% else %}—{% endif %}</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-strip-item">
|
||||||
|
<div class="label">总资金</div>
|
||||||
|
<div class="value" id="total-funds">{% if total_funds is not none %}{{ funds_fmt(total_funds) }}U{% else %}—{% endif %}</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-strip-item">
|
||||||
|
<div class="label">资金账户</div>
|
||||||
|
<div class="value" id="total-capital">{% if funding_usdt is not none %}{{ funds_fmt(funding_usdt) }}U{% else %}—{% endif %}</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-strip-item">
|
||||||
|
<div class="label">交易账户</div>
|
||||||
|
<div class="value" id="current-capital">{{ funds_fmt(current_capital) }}U</div>
|
||||||
|
</div>
|
||||||
|
{% if options_enabled %}
|
||||||
|
<div class="stat-strip-item">
|
||||||
|
<div class="label">期权资金账户</div>
|
||||||
|
<div class="value" id="options-funding-usdc">{{ options_funding_label(options_funding_usdc, options_funding_usdt) }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-strip-item">
|
||||||
|
<div class="label">期权交易账户</div>
|
||||||
|
<div class="value" id="options-trading-usdc">{% if options_trading_usdc is not none %}{{ funds_fmt(options_trading_usdc) }} USDC{% else %}—{% endif %}</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="stat-strip-item stat-strip-item--pnl">
|
||||||
|
<div class="label">实时盈亏</div>
|
||||||
|
<div class="value" id="realtime-pnl">—</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,5 +1,15 @@
|
|||||||
{# 系统设置:左风控说明 · 右资金划转 + 数据导出 #}
|
{# 系统设置:左风控说明 · 右资金划转 + 数据导出 #}
|
||||||
<div class="settings-page">
|
<div class="settings-page">
|
||||||
|
<div class="card settings-account-summary">
|
||||||
|
<div class="settings-account-summary-head">
|
||||||
|
<div class="instance-toolbar-status">
|
||||||
|
<div class="exchange-tag">{{ exchange_display }}</div>
|
||||||
|
<span class="risk-status-badge risk-status-{{ risk_status.status|default('normal') }}" role="status">{{ risk_status.status_label|default('正常') }}</span>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn-secondary btn-sm" id="settings-refresh-funds">刷新资金</button>
|
||||||
|
</div>
|
||||||
|
{% include 'instance_header_stats.html' %}
|
||||||
|
</div>
|
||||||
<div class="settings-cards-grid">
|
<div class="settings-cards-grid">
|
||||||
<div class="card settings-card settings-card--risk">
|
<div class="card settings-card settings-card--risk">
|
||||||
<h2>风控说明</h2>
|
<h2>风控说明</h2>
|
||||||
|
|||||||
Reference in New Issue
Block a user