移除全部对冲计划模块:crypto_okx 改为币本位单独期权执行机。

交易模式锁定 options;okx_trade_mode / 到期盈亏迁入 options;保留期权/桥/关键位/企微与中控预留快照口径。恢复点:backup/before-remove-hedge 与 tag backup-before-remove-hedge-20260930。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-09-30 23:20:21 +08:00
parent 8a62cfbb48
commit 0acba5e351
32 changed files with 11330 additions and 21601 deletions
+52
View File
@@ -0,0 +1,52 @@
"""对冲拆除后的冒烟:交易模式锁定单独期权;hedge_plan 包已移除."""
from __future__ import annotations
import importlib
import unittest
class RemoveHedgeSmokeTests(unittest.TestCase):
def test_trade_mode_always_options(self):
from lib.options.okx_trade_mode_lib import (
get_okx_trade_mode,
hedge_module_enabled,
standalone_options_open_allowed,
block_standalone_open_by_mode_msg,
normalize_okx_trade_mode,
)
self.assertEqual(normalize_okx_trade_mode("options_options"), "options")
self.assertEqual(normalize_okx_trade_mode("perp_options"), "options")
self.assertEqual(get_okx_trade_mode(), "options")
self.assertFalse(hedge_module_enabled())
self.assertTrue(standalone_options_open_allowed())
self.assertIsNone(block_standalone_open_by_mode_msg())
def test_hedge_plan_package_gone(self):
with self.assertRaises(ModuleNotFoundError):
importlib.import_module("lib.hedge_plan")
def test_option_expiry_pnl_available(self):
from lib.options.options_pricing_lib import option_expiry_pnl
pnl = option_expiry_pnl(
opt_type="P",
strike=2700,
spot=2600,
sheets=10,
ct_mult=0.01,
premium_paid=1.0,
)
# intrinsic = 100 * 10 * 0.01 = 10; pnl = 10 - 1 = 9
self.assertAlmostEqual(pnl, 9.0, places=6)
def test_profit_exit_no_hedge_import(self):
import inspect
from lib.options import options_profit_exit_lib as m
src = inspect.getsource(m)
self.assertNotIn("hedge_plan", src)
if __name__ == "__main__":
unittest.main()