YFinanceDataLoader

Description

YFinanceDataLoader is a data loader for Yahoo Finance data. It retrieves market data, supports caching, and organizes it into an xarray.Dataset.

Inherits

  • BaseDataSource

Methods

load_data

def load_data(self, **kwargs) -> xr.Dataset:

  • Description: Loads data from Yahoo Finance, with optional caching.

  • Parameters:

    • symbols (list): List of ticker symbols.

    • start_date (str): Start date for the data range.

    • end_date (str): End date for the data range.

    • frequency (str): Data frequency (e.g., '1d', '1h').

    • **kwargs: Additional parameters for customization.

  • Returns: xarray.Dataset containing the data.


_load_from_cache

def _load_from_cache(self, cache_path: Path) -> xr.Dataset:

  • Description: Loads data from the local cache.

  • Parameters:

    • cache_path (Path): Path to the cache file.

  • Returns: Cached xarray.Dataset.


_load_from_yahoo

def _load_from_yahoo(self, symbols: list, start_date: str, end_date: str, frequency: str, cache_path: Path, params: dict) -> xr.Dataset:

  • Description: Downloads data from Yahoo Finance, processes it, and saves it to the cache.

  • Parameters:

    • symbols (list): List of ticker symbols.

    • start_date (str): Start date for the data range.

    • end_date (str): End date for the data range.

    • frequency (str): Data frequency.

    • cache_path (Path): Cache file path.

    • params (dict): Dictionary of parameters for caching.

  • Returns: Processed xarray.Dataset.


Last updated