Skip to content

MappingContractFactorProvider

QuantConnect.Data.Auxiliary.MappingContractFactorProvider

MappingContractFactorProvider(
    permtick: str,
    data: List[MappingContractFactorRow],
    factor_file_minimum_date: Optional[datetime] = None,
)

Bases: FactorFile[MappingContractFactorRow]

Mapping related factor provider. Factors based on price differences on mapping dates

Creates a new instance

permtick

permtick: str

Gets the symbol this factor file represents

factor_file_minimum_date

factor_file_minimum_date: Optional[datetime]

The minimum tradeable date for the symbol

reversed_factor_file_dates

reversed_factor_file_dates: List[datetime]

Keeping a reversed version is more performant that reversing it each time we need it

This codeEntityType is protected.

sorted_factor_file_data

sorted_factor_file_data: SortedList[
    datetime, List[QuantConnect_Data_Auxiliary_FactorFile_T]
]

The factor file data rows sorted by date

most_recent_factor_change

most_recent_factor_change: datetime

Gets the most recent factor change in the factor file

get_price_factor

get_price_factor(
    search_date: Union[datetime, date],
    data_normalization_mode: DataNormalizationMode,
    data_mapping_mode: Optional[DataMappingMode] = None,
    contract_offset: int = 0,
) -> float

Gets the price scale factor for the specified search date

__iter__

__iter__() -> Iterator[IFactorRow]

get_enumerator

get_enumerator() -> IEnumerator[IFactorRow]

Returns an enumerator that iterates through the collection.

Returns:

Type Description
IEnumerator[IFactorRow]

A System.Collections.Generic.IEnumerator`1 that can be used to iterate through the collection.

get_file_format

get_file_format() -> Iterable[str]

Writes this factor file data to an enumerable of csv lines

Returns:

Type Description
Iterable[str]

An enumerable of lines representing this factor file.

write_to_file

write_to_file(
    symbol: Union[Symbol, str, BaseContract],
) -> None

Write the factor file to the correct place in the default Data folder

Parameters:

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

The symbol this factor file represents

required