Skip to content

IndexSubscriptionDataSourceReader

QuantConnect.Lean.Engine.DataFeeds.IndexSubscriptionDataSourceReader

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

Bases: BaseSubscriptionDataSourceReader

This ISubscriptionDataSourceReader implementation supports the FileFormat.INDEX and IndexedBaseData types. Handles the layer of indirection for the index data source and forwards the target source to the corresponding ISubscriptionDataSourceReader

Creates a new instance of this ISubscriptionDataSourceReader

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