data_loader =========== .. py:module:: data_loader Classes ------- .. autoapisummary:: data_loader.DataSource data_loader.AlpacaDataLoader data_loader.DataLoader Module Contents --------------- .. py:class:: DataSource(**kwargs) Base class for all data sources in the Rambling Realms trading system. This class provides a common interface for fetching and processing data from various sources. Subclasses should implement the `get_data` method to fetch data from their respective sources. .. py:attribute:: _registry :type: ClassVar[Dict[trading.cli.alg.config.DataSourceType, Type[DataSource]]] .. py:method:: get_data(fetch_data, request, df, cache_path, start_date, end_date, time_step_unit = TimeFrameUnit('Day'), cache_enabled = True, time_step_period = 1, **kwargs) :abstractmethod: .. py:method:: __init_subclass__(**kwargs) :classmethod: .. py:method:: factory(data) :classmethod: Factory method to create an instance of a DataSource subclass based on the provided data. The data dictionary must contain a 'source' key that matches one of the DataSourceType enum values. Raises ValueError if the 'source' key is missing or if the type is unknown. .. py:class:: AlpacaDataLoader(**kwargs) Bases: :py:obj:`DataSource` ! TODO add columns to and from parquet .. py:attribute:: TYPE :type: ClassVar[trading.cli.alg.config.DataSourceType] .. py:method:: get_data(fetch_data, request, df, cache_path, start_date, end_date, time_step_unit = TimeFrameUnit.Day, cache_enabled = True, time_step_period = 1, **kwargs) Fetches data from Alpaca and caches it locally. .. py:class:: DataLoader(data_config, feature_config, fetch_data = False, **kwargs) DataLoader class for loading and processing data from various sources. It initializes with a DataConfig and FeatureConfig, fetches data from the specified sources, and applies the specified features to the data. ! todo no drop on on live .. py:attribute:: data_config .. py:attribute:: feature_config .. py:attribute:: df .. py:attribute:: columns .. py:attribute:: features .. py:method:: data_info(df) :classmethod: Returns a string representation of the dataframe. .. py:method:: get_train_test() Splits the DataFrame into training and validation sets based on the validation split ratio. .. py:method:: to_csv(path) Saves the DataFrame to a CSV file.