From 52d654285ef8abbe9669aeffe619de790639aba5 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Wed, 19 Jul 2023 11:17:23 -0400 Subject: [PATCH] Annoyingly, DTE can sometimes go negative --- thetagang/util.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/thetagang/util.py b/thetagang/util.py index 37e8a23f8..d1784ef6d 100644 --- a/thetagang/util.py +++ b/thetagang/util.py @@ -72,8 +72,11 @@ def net_option_positions(symbol, portfolio_positions, right, ignore_zero_dte=Fal if isinstance(p.contract, Option) and p.contract.right.upper().startswith(right.upper()) and ( - not ignore_zero_dte - or option_dte(p.contract.lastTradeDateOrContractMonth) > 0 + ( + not ignore_zero_dte + or option_dte(p.contract.lastTradeDateOrContractMonth) > 0 + ) + or option_dte(p.contract.lastTradeDateOrContractMonth) >= 0 ) ] )