Skip to content

CollectionSubscriptionDataSourceReader

QuantConnect.Lean.Engine.DataFeeds.CollectionSubscriptionDataSourceReader

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

Bases: BaseSubscriptionDataSourceReader

Collection Subscription Factory takes a BaseDataCollection from BaseData factories and yields it one point at a time to the algorithm

Initializes a new instance of the CollectionSubscriptionDataSourceReader class

Parameters:

Name Type Description Default
data_cache_provider IDataCacheProvider

Used to cache data for requested from the IDataProvider

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

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)

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.

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