liveBook · Manning

ISO 8601

As explained in Statistics Every Programmer Needs

ISO 8601 is an international standard for unambiguous representation of dates, times, durations, and intervals.

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

How Statistics Every Programmer Needs covers it

How deep it goes
Defines YYYY-MM-DD and related temporal forms, but does not develop the standard’s full specification.
Examples
Uses AAPL retrieval between 2023-10-01 and 2024-04-30 with daily, hourly, or weekly intervals.
What it assumes
Assumes basic Python and financial-data retrieval concepts while teaching the required date format.
What you can do after
Apply it via yfinance to submit unambiguous date ranges without date-interpretation errors.
How it connects
Connects date representation with time handling, financial data retrieval, and time-series analysis.

Also explained in

Compare how 2 books explain ISO 8601 →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.