**Describe the behavior
Options-chain DTE calculations appear to depend on the local timezone of the machine running OpenBB.
For example, the YFinance options-chain provider obtains the exchange timezone:
tz = timezone(underlying.get("exchangeTimezoneName", "UTC"))
However, DTE is calculated using the machine’s local calendar date:
now = datetime.now().date()
dte = (exp - now).days
I found similar local-date calculations in other options-chain providers, so I wanted to confirm the intended cross-provider convention before proposing a code change.
** To reproduce
At the same instant worldwide:
from datetime import datetime, timezone
from pytz import timezone as get_timezone
instant = datetime(
2026,
7,
28,
1,
30,
tzinfo=timezone.utc,
)
exchange_timezone = get_timezone("America/New_York")
machine_timezone = get_timezone("Asia/Tokyo")
exchange_date = instant.astimezone(exchange_timezone).date()
machine_date = instant.astimezone(machine_timezone).date()
expiration = datetime(2026, 7, 31).date()
exchange_dte = (expiration - exchange_date).days
machine_dte = (expiration - machine_date).days
print("Exchange calendar date:", exchange_date)
print("Machine calendar date:", machine_date)
print("DTE using exchange date:", exchange_dte)
print("DTE using machine date:", machine_dte)
Output:
Exchange calendar date: 2026-07-27
Machine calendar date: 2026-07-28
DTE using exchange date: 4
DTE using machine date: 3
The same contract can therefore receive a different DTE depending on the user’s machine timezone.
** Expected behavior / question
What is the intended convention for options-chain DTE across providers?
- Machine-local date
- UTC date
- Exchange-local date
- A date or DTE supplied directly by the provider
I would be happy to contribute a deterministic regression test and implementation once the intended behavior and scope are confirmed.
** Desktop
- OS: macOS
- Python version: 3.14.4
- Branch:
develop
** Additional context
I have not changed the implementation yet because multiple providers appear to use the machine-local date, and changing only YFinance could introduce inconsistent behavior across providers.
**Describe the behavior
Options-chain DTE calculations appear to depend on the local timezone of the machine running OpenBB.
For example, the YFinance options-chain provider obtains the exchange timezone:
However, DTE is calculated using the machine’s local calendar date:
I found similar local-date calculations in other options-chain providers, so I wanted to confirm the intended cross-provider convention before proposing a code change.
** To reproduce
At the same instant worldwide:
Output:
The same contract can therefore receive a different DTE depending on the user’s machine timezone.
** Expected behavior / question
What is the intended convention for options-chain DTE across providers?
I would be happy to contribute a deterministic regression test and implementation once the intended behavior and scope are confirmed.
** Desktop
develop** Additional context
I have not changed the implementation yet because multiple providers appear to use the machine-local date, and changing only YFinance could introduce inconsistent behavior across providers.