harbor run -t openthoughts/tasktrove-exp-rpt-stack-pytest-v2-stack-pytest-0317harbor download openthoughts/tasktrove-exp-rpt-stack-pytest-v2-stack-pytest-0317Task: Implement a lightweight iexfinance module that provides a time-series data accessor compatible with the provided tests.
Location: Implement the functionality in /app/iexfinance.py (as a single module). If your environment prefers a package layout, you may implement an equivalent package under /app/iexfinance/ with a data_apis.py module, but the primary requirement is to deliver a module at /app/iexfinance.py that exposes the expected behavior described below.
What to implement
def get_time_series(series_name: str = None, symbol: str = None, last: int = None, output_format: str = None): """ Retrieve time-series data (stubbed for testing).
- series_name: name of the time-series to fetch (e.g., "REPORTED_FINANCIALS").
- symbol: ticker symbol (e.g., "AAPL").
- last: number of most recent periods to include (positive int). If None, use a sensible default (e.g., 3).
- output_format: if exactly "pandas", return a pandas DataFrame; otherwise return a Python list.
"""
...
When output_format == "pandas":
When output_format is None or any value other than "pandas":
The tests that exercise the pandas path (test_all_series_pandas) are marked xfail in the provided suite. Implementing the pandas path correctly will still satisfy the intended shape/type expectations; ensure the function does not require network access or external endpoints.
test_params calls: data = get_time_series("REPORTED_FINANCIALS", "AAPL", last=1)
So your DataFrame must have its columns attribute as a pandas DatetimeIndex. A single-column DatetimeIndex is acceptable for last=1.
Optional guidance (implementation hints)
To generate a DatetimeIndex for columns:
For the non-pandas path, a simple structure like:
Deliverable