fix(hedge): filter options-chain by min hours and strike interval for option-primary

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-09 08:38:11 +08:00
parent afe361ce47
commit e7e733d9a9
5 changed files with 74 additions and 5 deletions
+8
View File
@@ -139,6 +139,14 @@ class TestOptionPrimary(unittest.TestCase):
self.assertTrue(out["option_primary"])
self.assertEqual(len(out["scenarios"]), 2)
def test_hours_to_expiry_from_ms(self):
from lib.hedge_plan.hedge_plan_option_primary_lib import hours_to_expiry_from_ms
now = 1_700_000_000_000.0
# +40h in ms
h = hours_to_expiry_from_ms(now + 40 * 3600 * 1000, now_ms=now)
self.assertAlmostEqual(h, 40.0, places=3)
if __name__ == "__main__":
unittest.main()