Skip to content

BaseDataCollectionAggregatorReader

QuantConnect.Lean.Engine.DataFeeds.BaseDataCollectionAggregatorReader

BaseDataCollectionAggregatorReader(
    data_cache_provider: IDataCacheProvider,
    config: SubscriptionDataConfig,
    date: Union[datetime, date],
    is_live_mode: bool,
    object_store: IObjectStore,
)

Bases: TextSubscriptionDataSourceReader

Data source reader that will aggregate data points into a base data collection

Initializes a new instance of the TextSubscriptionDataSourceReader class

Parameters:

Name Type Description Default
data_cache_provider IDataCacheProvider

This provider caches files if needed

required
config SubscriptionDataConfig

The subscription's configuration

required
date Union[datetime, date]

The date this factory was produced to read data for

required
is_live_mode bool

True if we're in live mode, false for backtesting

required
object_store IObjectStore

The object storage for data persistence

required

invalid_source

invalid_source: _EventContainer[
    Callable[[Object, InvalidSourceEventArgs], Any], Any
]

Event fired when the specified source is considered invalid, this may be from a missing file or failure to download a remote source

is_live_mode

is_live_mode: bool

True if we're in live mode, false for backtesting

This codeEntityType is protected.

data_cache_provider

data_cache_provider: IDataCacheProvider

The data cache provider to use

This codeEntityType is protected.

object_store

object_store: IObjectStore

The object store to use

This codeEntityType is protected.

config

The requested subscription configuration

This codeEntityType is protected.

reader_error

reader_error: _EventContainer[
    Callable[[Object, ReaderErrorEventArgs], Any], Any
]

Event fired when an exception is thrown during a call to BaseData.reader(SubscriptionDataConfig,string,DateTime,bool)

read

read(source: SubscriptionDataSource) -> Iterable[BaseData]

Reads the specified source

Parameters:

Name Type Description Default
source SubscriptionDataSource

The source to be read

required

Returns:

Type Description
Iterable[BaseData]

An IEnumerable{BaseData} that contains the data in the source.

create_stream_reader

create_stream_reader(
    subscription_data_source: SubscriptionDataSource,
) -> IStreamReader

Creates a new IStreamReader for the specified subscription_data_source

This codeEntityType is protected.

Parameters:

Name Type Description Default
subscription_data_source SubscriptionDataSource

The source to produce an IStreamReader for

required

Returns:

Type Description
IStreamReader

A new instance of IStreamReader to read the source, or null if there was an error.

on_invalid_source

on_invalid_source(
    source: SubscriptionDataSource, exception: Exception
) -> None

Event invocator for the invalid_source event

This codeEntityType is protected.

Parameters:

Name Type Description Default
source SubscriptionDataSource

The SubscriptionDataSource that was invalid

required
exception Exception

The exception if one was raised, otherwise null

required

clear_cache

clear_cache() -> None

Will clear the data cache. Used for testing different time zones for the same data set and allow a clean fresh start for each backtest

set_cache_size

set_cache_size(mega_bytes_to_use: int) -> None

Set the cache size to use