Skip to content

MappingExtensions

QuantConnect.Data.Auxiliary.MappingExtensions

Bases: Object

Mapping extensions helper methods

resolve_map_file

resolve_map_file(
    map_file_provider: IMapFileProvider,
    data_config: SubscriptionDataConfig,
) -> MapFile
resolve_map_file(
    map_file_resolver: MapFileResolver,
    symbol: Union[Symbol, str, BaseContract],
    data_type: str = None,
) -> MapFile

Helper method to resolve the mapping file to use.

Parameters:

Name Type Description Default
map_file_provider Optional[IMapFileProvider]

The map file provider

None
data_config Optional[SubscriptionDataConfig]

The configuration to fetch the map file for

None
map_file_resolver Optional[MapFileResolver]

The map file resolver

None
symbol Optional[Union[Symbol, str, BaseContract]]

The symbol that we want to map

None
data_type Optional[str]

The string data type name if any

None

Returns:

Type Description
MapFile

The mapping file to use.

retrieve_all_mapped_symbol_in_date_range

retrieve_all_mapped_symbol_in_date_range(
    map_file_provider: IMapFileProvider,
    symbol: Union[Symbol, str, BaseContract],
) -> Iterable[SymbolDateRange]

Retrieves all Symbol from map files based on specific Symbol.

Parameters:

Name Type Description Default
map_file_provider IMapFileProvider

The provider for map files containing ticker data.

required
symbol Union[Symbol, str, BaseContract]

The symbol to get MapFileResolver and generate new Symbol.

required

Returns:

Type Description
Iterable[SymbolDateRange]

An enumerable collection of SymbolDateRange.

retrieve_symbol_historical_definitions_in_date_range

retrieve_symbol_historical_definitions_in_date_range(
    map_file_provider: IMapFileProvider,
    symbol: Union[Symbol, str, BaseContract],
    start_date_time: Union[datetime, date],
    end_date_time: Union[datetime, date],
) -> Iterable[TickerDateRange]

Some historical provider supports ancient data. In fact, the ticker could be restructured to new one.

Parameters:

Name Type Description Default
map_file_provider IMapFileProvider

Provides instances of MapFileResolver at run time

required
symbol Union[Symbol, str, BaseContract]

Represents a unique security identifier

required
start_date_time Union[datetime, date]

The date since we began our search for the historical name of the symbol.

required
end_date_time Union[datetime, date]

The end date and time of the historical data range.

required

Returns:

Type Description
Iterable[TickerDateRange]

An enumerable collection of tuples containing symbol ticker, start date and time, and end date and time representing the historical definitions of the symbol within the specified time range.