修复 BTC 币本位期权净盈亏被 round4 抹成 0 的精度问题。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-02 14:51:59 +08:00
parent bc86723b39
commit 61808a5374
5 changed files with 52 additions and 13 deletions
+5 -1
View File
@@ -1209,7 +1209,11 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
sizing = dict(sizing)
sizing["sheets"] = sheets
sizing["eth_amount"] = round(sheets * ct_mult, 8)
sizing["total_premium"] = round(fill_px * sheets * ct_mult, 4)
from lib.options.options_pricing_lib import PREMIUM_DECIMALS_COIN, round_premium_amount
sizing["total_premium"] = round_premium_amount(
fill_px * sheets * ct_mult, decimals=PREMIUM_DECIMALS_COIN
)
conn = cfg["get_db"]()
trade_id = None
target_mon = None