Skip to content

SubscriptionDataReader

QuantConnect.Lean.Engine.DataFeeds.SubscriptionDataReader

SubscriptionDataReader(
    config: SubscriptionDataConfig,
    data_request: BaseDataRequest,
    map_file_provider: IMapFileProvider,
    factor_file_provider: IFactorFileProvider,
    data_cache_provider: IDataCacheProvider,
    data_provider: IDataProvider,
    object_store: IObjectStore,
)

Bases: Object, IEnumerator[BaseData], ITradableDatesNotifier, IDataProviderEvents

Subscription data reader is a wrapper on the stream reader class to download, unpack and iterate over a data file.

Subscription data reader takes a subscription request, loads the type, accepts the data source and enumerate on the results.

Parameters:

Name Type Description Default
config SubscriptionDataConfig

Subscription configuration object

required
data_request BaseDataRequest

The data request

required
map_file_provider IMapFileProvider

Used for resolving the correct map files

required
factor_file_provider IFactorFileProvider

Used for getting factor files

required
data_cache_provider IDataCacheProvider

Used for caching files

required
data_provider IDataProvider

The data provider to use

required

invalid_configuration_detected

invalid_configuration_detected: _EventContainer[
    Callable[
        [Object, InvalidConfigurationDetectedEventArgs], Any
    ],
    Any,
]

Event fired when an invalid configuration has been detected

numerical_precision_limited

numerical_precision_limited: _EventContainer[
    Callable[
        [Object, NumericalPrecisionLimitedEventArgs], Any
    ],
    Any,
]

Event fired when the numerical precision in the factor file has been limited

start_date_limited

start_date_limited: _EventContainer[
    Callable[[Object, StartDateLimitedEventArgs], Any], Any
]

Event fired when the start date has been limited

download_failed

download_failed: _EventContainer[
    Callable[[Object, DownloadFailedEventArgs], Any], Any
]

Event fired when there was an error downloading a remote file

reader_error_detected

reader_error_detected: _EventContainer[
    Callable[[Object, ReaderErrorDetectedEventArgs], Any],
    Any,
]

Event fired when there was an error reading the data

new_tradable_date

new_tradable_date: _EventContainer[
    Callable[[Object, NewTradableDateEventArgs], Any], Any
]

Event fired when there is a new tradable date

current

current: BaseData

Last read BaseData object from this type and source

dispose

dispose() -> None

Dispose of the Stream Reader and close out the source stream and file connections.

initialize

initialize() -> None

Initializes the SubscriptionDataReader instance

move_next

move_next() -> bool

Advances the enumerator to the next element of the collection.

Returns:

Type Description
bool

true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

on_download_failed

on_download_failed(e: DownloadFailedEventArgs) -> None

Event invocator for the download_failed event

This codeEntityType is protected.

Parameters:

Name Type Description Default
e DownloadFailedEventArgs

Event arguments for the download_failed event

required

on_invalid_configuration_detected

on_invalid_configuration_detected(
    e: InvalidConfigurationDetectedEventArgs,
) -> None

Event invocator for the invalid_configuration_detected event

This codeEntityType is protected.

Parameters:

Name Type Description Default
e InvalidConfigurationDetectedEventArgs

Event arguments for the invalid_configuration_detected event

required

on_new_tradable_date

on_new_tradable_date(e: NewTradableDateEventArgs) -> None

Event invocator for the new_tradable_date event

This codeEntityType is protected.

Parameters:

Name Type Description Default
e NewTradableDateEventArgs

Event arguments for the new_tradable_date event

required

on_numerical_precision_limited

on_numerical_precision_limited(
    e: NumericalPrecisionLimitedEventArgs,
) -> None

Event invocator for the numerical_precision_limited event

This codeEntityType is protected.

Parameters:

Name Type Description Default
e NumericalPrecisionLimitedEventArgs

Event arguments for the numerical_precision_limited event

required

on_reader_error_detected

on_reader_error_detected(
    e: ReaderErrorDetectedEventArgs,
) -> None

Event invocator for the reader_error_detected event

This codeEntityType is protected.

Parameters:

Name Type Description Default
e ReaderErrorDetectedEventArgs

Event arguments for the reader_error_detected event

required

on_start_date_limited

on_start_date_limited(e: StartDateLimitedEventArgs) -> None

Event invocator for the start_date_limited event

This codeEntityType is protected.

Parameters:

Name Type Description Default
e StartDateLimitedEventArgs

Event arguments for the start_date_limited event

required

reset

reset() -> None

Reset the IEnumeration