划转默认折叠,修复币本位到期平衡计算
币本位权利金为币报价,到期平衡按 OKX 结算公式 K/(1±p) 计算;链/持仓/跨式平衡带同步修正。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -816,6 +816,7 @@ def build_option_chain(
|
||||
family = f"{u}-USD_UM"
|
||||
uly = f"{u}-USD"
|
||||
idx = index_px if index_px is not None else fetch_index_price(ex, uly)
|
||||
chain_margin = "usdc" if "_UM" in family.upper() else "coin"
|
||||
now_ms = time.time() * 1000
|
||||
max_ms = now_ms + max_dte_days * 86400 * 1000
|
||||
instruments_err = ""
|
||||
@@ -884,6 +885,8 @@ def build_option_chain(
|
||||
strike=strike,
|
||||
ask_px=ask,
|
||||
mark_px=mark,
|
||||
inst_id=inst_id,
|
||||
margin_mode=chain_margin,
|
||||
)
|
||||
mny = option_moneyness(opt_type=opt_type, strike=strike, index_px=idx)
|
||||
exp_key = str(exp_ms)
|
||||
@@ -1028,6 +1031,7 @@ def quote_option_contract(ex: ccxt.okx, inst_id: str) -> dict[str, Any]:
|
||||
strike=strike,
|
||||
ask_px=book_ask if can_open else None,
|
||||
mark_px=mark,
|
||||
inst_id=inst_id,
|
||||
)
|
||||
return {
|
||||
"ok": True,
|
||||
@@ -1815,6 +1819,8 @@ def format_position_row(
|
||||
strike=strike,
|
||||
avg_px=avg,
|
||||
be_px_api=_safe_float(pos.get("bePx")),
|
||||
inst_id=inst_id,
|
||||
margin_mode=row_mode,
|
||||
)
|
||||
close_be = close_breakeven_idx(
|
||||
opt_type=str(opt_type or ""),
|
||||
|
||||
Reference in New Issue
Block a user