Align margin display with CTP counter rates and position margin.
Read margin ratios from CTP instrument query and margin-rate API instead of vnpy ContractData (which lacks ratios). Keep occupied margin on position UseMargin; use per-lot max rate for recommend table. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -216,7 +216,7 @@ def assess_product_for_capital(
|
||||
code_for_margin = (main_code or "").strip() or (ths + "8888")
|
||||
if p > 0 and ctp_connected:
|
||||
margin_one, margin_source, spec_used = margin_one_lot(
|
||||
code_for_margin, p, trading_mode=trading_mode,
|
||||
code_for_margin, p, direction="max", trading_mode=trading_mode,
|
||||
)
|
||||
if spec_used.get("mult"):
|
||||
mult = spec_used["mult"]
|
||||
|
||||
Reference in New Issue
Block a user