Replace 期期 equal-split with long/short bias sizing and env ratio controls.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -153,19 +153,57 @@ class TestHedgePlanCalc(unittest.TestCase):
|
||||
self.assertEqual(s["sheets_b"], 5)
|
||||
self.assertTrue(s["ok"])
|
||||
|
||||
def test_suggest_oo_split_budget(self):
|
||||
# cost_a=1, cost_b=2; half=5 → nA=5, nB=2
|
||||
def test_suggest_oo_long_bias_budget(self):
|
||||
# cost_call=1, cost_put=1; budget 10 → call 7U / put 3U → 7 / 3
|
||||
s = suggest_oo_sheets(
|
||||
mode="split_budget",
|
||||
mode="long_bias",
|
||||
budget_usdc=10,
|
||||
ask_a=100,
|
||||
ct_mult_a=0.01,
|
||||
ask_b=200,
|
||||
opt_type_a="C",
|
||||
ask_b=100,
|
||||
ct_mult_b=0.01,
|
||||
opt_type_b="P",
|
||||
bias_split_by="budget",
|
||||
bias_ratio=0.7,
|
||||
)
|
||||
self.assertEqual(s["mode"], "split_budget")
|
||||
self.assertEqual(s["sheets_a"], 5)
|
||||
self.assertEqual(s["sheets_b"], 2)
|
||||
self.assertEqual(s["mode"], "long_bias")
|
||||
self.assertEqual(s["sheets_a"], 7)
|
||||
self.assertEqual(s["sheets_b"], 3)
|
||||
self.assertTrue(s["ok"])
|
||||
|
||||
def test_suggest_oo_short_bias_sheets(self):
|
||||
# same n=5; short → put major 4 / call minor 1 (round 5*0.7=4)
|
||||
s = suggest_oo_sheets(
|
||||
mode="short_bias",
|
||||
budget_usdc=10,
|
||||
ask_a=100,
|
||||
ct_mult_a=0.01,
|
||||
opt_type_a="C",
|
||||
ask_b=100,
|
||||
ct_mult_b=0.01,
|
||||
opt_type_b="P",
|
||||
bias_split_by="sheets",
|
||||
bias_ratio=0.7,
|
||||
)
|
||||
self.assertEqual(s["mode"], "short_bias")
|
||||
self.assertEqual(s["sheets_a"], 1)
|
||||
self.assertEqual(s["sheets_b"], 4)
|
||||
|
||||
def test_suggest_oo_bias_requires_call_put(self):
|
||||
s = suggest_oo_sheets(
|
||||
mode="long_bias",
|
||||
budget_usdc=10,
|
||||
ask_a=100,
|
||||
ct_mult_a=0.01,
|
||||
opt_type_a="C",
|
||||
ask_b=100,
|
||||
ct_mult_b=0.01,
|
||||
opt_type_b="C",
|
||||
bias_split_by="budget",
|
||||
)
|
||||
self.assertFalse(s["ok"])
|
||||
self.assertIn("Call", s["msg"])
|
||||
|
||||
def test_suggest_oo_depth_cap(self):
|
||||
s = suggest_oo_sheets(
|
||||
|
||||
Reference in New Issue
Block a user