Skip to content

etf

Bases: time_series_dataloader

A data loader for ETF (Exchange Traded Funds) time series datasets.

This class handles loading, partitioning, and preparing ETF time series data for training and testing.

Attributes:

Name Type Description
name str

Name of the dataset, default is 'etfs'.

x_len int

Length of the input time series.

y_len int

Length of the output time series.

xy_gap int

Gap between the input and output time series.

coverage_year_range int

Range of years covered by the data.

time_granularity str

Time granularity of the data, e.g., 'daily', 'weekly', etc.

target_attributes str

Target attribute to predict, e.g., 'Open', 'Close', etc.

Methods:

Name Description
__init__

Initializes the ETF data loader with dataset-specific configurations.

Source code in tinybig/data/time_series_dataloader.py
class etf(time_series_dataloader):
    """
    A data loader for ETF (Exchange Traded Funds) time series datasets.

    This class handles loading, partitioning, and preparing ETF time series data for training and testing.

    Attributes
    ----------
    name : str
        Name of the dataset, default is 'etfs'.
    x_len : int
        Length of the input time series.
    y_len : int
        Length of the output time series.
    xy_gap : int
        Gap between the input and output time series.
    coverage_year_range : int
        Range of years covered by the data.
    time_granularity : str
        Time granularity of the data, e.g., 'daily', 'weekly', etc.
    target_attributes : str
        Target attribute to predict, e.g., 'Open', 'Close', etc.

    Methods
    -------
    __init__(...)
        Initializes the ETF data loader with dataset-specific configurations.
    """
    def __init__(
        self,
        name: str = ETF_DATA_PROFILE['name'],
        x_len: int = 10,
        y_len: int = 1,
        xy_gap: int = 1,
        coverage_year_range: int = 1,
        time_granularity: str = 'daily',
        target_attributes: str = 'Open',
        *args, **kwargs
    ):
        """
        Initializes the ETF data loader with specific configurations.

        Parameters
        ----------
        name : str, optional
            Name of the dataset, default is 'etfs'.
        x_len : int, optional
            Length of the input time series, default is 10.
        y_len : int, optional
            Length of the output time series, default is 1.
        xy_gap : int, optional
            Gap between the input and output time series, default is 1.
        coverage_year_range : int, optional
            Range of years covered by the data, default is 1.
        time_granularity : str, optional
            Time granularity of the data, default is 'daily'.
        target_attributes : str, optional
            Target attribute to predict, default is 'Open'.
        *args, **kwargs
            Additional arguments for the parent class initialization.

        Returns
        -------
        None
        """
        super().__init__(
            name=name,
            data_profile=ETF_DATA_PROFILE,
            x_len=x_len, y_len=y_len, xy_gap=xy_gap,
            coverage_year_range=coverage_year_range,
            time_granularity=time_granularity,
            target_attributes=target_attributes,
            *args, **kwargs
        )

__init__(name=ETF_DATA_PROFILE['name'], x_len=10, y_len=1, xy_gap=1, coverage_year_range=1, time_granularity='daily', target_attributes='Open', *args, **kwargs)

Initializes the ETF data loader with specific configurations.

Parameters:

Name Type Description Default
name str

Name of the dataset, default is 'etfs'.

ETF_DATA_PROFILE['name']
x_len int

Length of the input time series, default is 10.

10
y_len int

Length of the output time series, default is 1.

1
xy_gap int

Gap between the input and output time series, default is 1.

1
coverage_year_range int

Range of years covered by the data, default is 1.

1
time_granularity str

Time granularity of the data, default is 'daily'.

'daily'
target_attributes str

Target attribute to predict, default is 'Open'.

'Open'
*args

Additional arguments for the parent class initialization.

()
**kwargs

Additional arguments for the parent class initialization.

()

Returns:

Type Description
None
Source code in tinybig/data/time_series_dataloader.py
def __init__(
    self,
    name: str = ETF_DATA_PROFILE['name'],
    x_len: int = 10,
    y_len: int = 1,
    xy_gap: int = 1,
    coverage_year_range: int = 1,
    time_granularity: str = 'daily',
    target_attributes: str = 'Open',
    *args, **kwargs
):
    """
    Initializes the ETF data loader with specific configurations.

    Parameters
    ----------
    name : str, optional
        Name of the dataset, default is 'etfs'.
    x_len : int, optional
        Length of the input time series, default is 10.
    y_len : int, optional
        Length of the output time series, default is 1.
    xy_gap : int, optional
        Gap between the input and output time series, default is 1.
    coverage_year_range : int, optional
        Range of years covered by the data, default is 1.
    time_granularity : str, optional
        Time granularity of the data, default is 'daily'.
    target_attributes : str, optional
        Target attribute to predict, default is 'Open'.
    *args, **kwargs
        Additional arguments for the parent class initialization.

    Returns
    -------
    None
    """
    super().__init__(
        name=name,
        data_profile=ETF_DATA_PROFILE,
        x_len=x_len, y_len=y_len, xy_gap=xy_gap,
        coverage_year_range=coverage_year_range,
        time_granularity=time_granularity,
        target_attributes=target_attributes,
        *args, **kwargs
    )