ISO 8601 standardizes dates and times so programs and data services interpret year, month, and day consistently. The date form YYYY-MM-DD is used for unambiguous historical-data requests. section 7.2.1
For financial time-series retrieval, ISO 8601 provides:
- A compatible format for start and end dates passed to a history() request. section 7.2.1
- Reduced ambiguity across countries and systems by fixing the order of date components. section 7.2.1
- Related representations for times, durations, and combined date-time values. section 7.2.1
Date-bounded stock retrieval
Pass '2023-10-01' and '2024-04-30' as the start and end dates when retrieving AAPL history; use the interval parameter for daily, hourly, or weekly data. section 7.2.1
>>> def fetch_stock_data(ticker_symbol, start_date, end_date,
>>> interval = '1d'):
>>> ticker_data = yf.Ticker(ticker_symbol)
>>> stock_data = ticker_data.history(start = start_date,
end = end_date,
interval = interval)
>>> return stock_data
Inspect the reusable Python function that sends ISO-formatted dates to a ticker's history() method. section 7.2.1

