Skip to content

FakeDataQueue

QuantConnect.Lean.Engine.DataFeeds.Queues.FakeDataQueue

FakeDataQueue()
FakeDataQueue(
    data_aggregator: IDataAggregator,
    data_points_per_second_per_symbol: int = 500000,
)

Bases: Object, IDataQueueHandler, IDataQueueUniverseProvider

This is an implementation of IDataQueueHandler used for testing. FakeHistoryProvider

Initializes a new instance of the FakeDataQueue class to randomly emit data for each symbol

time_provider

time_provider: ITimeProvider

Continuous UTC time provider

This codeEntityType is protected.

is_connected

is_connected: bool

Returns whether the data provider is connected

can_perform_selection

can_perform_selection() -> bool

Checks if the FakeDataQueue can perform selection

dispose

dispose() -> None

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

lookup_symbols

lookup_symbols(
    symbol: Union[Symbol, str, BaseContract],
    include_expired: bool,
    security_currency: str = None,
) -> Iterable[Symbol]

Method returns a collection of Symbols that are available at the data source.

Parameters:

Name Type Description Default
symbol Union[Symbol, str, BaseContract]

Symbol to lookup

required
include_expired bool

Include expired contracts

required
security_currency str

Expected security currency(if any)

None

Returns:

Type Description
Iterable[Symbol]

Enumerable of Symbols, that are associated with the provided Symbol.

set_job

set_job(job: LiveNodePacket) -> None

Sets the job we're subscribing for

Parameters:

Name Type Description Default
job LiveNodePacket

Job we're subscribing for

required

subscribe

subscribe(
    data_config: SubscriptionDataConfig,
    new_data_available_handler: Callable[
        [Object, EventArgs], Any
    ],
) -> IEnumerator[BaseData]

Subscribe to the specified configuration

Parameters:

Name Type Description Default
data_config SubscriptionDataConfig

defines the parameters to subscribe to a data feed

required
new_data_available_handler Callable[[Object, EventArgs], Any]

handler to be fired on new data available

required

Returns:

Type Description
IEnumerator[BaseData]

The new enumerator for this subscription request.

unsubscribe

unsubscribe(data_config: SubscriptionDataConfig) -> None

Removes the specified configuration

Parameters:

Name Type Description Default
data_config SubscriptionDataConfig

Subscription config to be removed

required