Skip to content

MapFile

QuantConnect.Data.Auxiliary.MapFile

MapFile(permtick: str, data: List[MapFileRow])

Bases: Object, Iterable[MapFileRow]

Represents an entire map file for a specified symbol

Initializes a new instance of the MapFile class.

permtick

permtick: str

Gets the entity's unique symbol, i.e OIH.1

delisting_date

delisting_date: datetime

Gets the last date in the map file which is indicative of a delisting event

first_date

first_date: datetime

Gets the first date in this map file

first_ticker

first_ticker: str

Gets the first ticker for the security represented by this map file

__iter__

__iter__() -> Iterator[MapFileRow]

get_enumerator

get_enumerator() -> IEnumerator[MapFileRow]

Returns an enumerator that iterates through the collection.

Returns:

Type Description
IEnumerator[MapFileRow]

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

get_map_files

get_map_files(
    map_file_directory: str,
    market: str,
    security_type: SecurityType,
    data_provider: IDataProvider,
) -> Iterable[MapFile]

Reads all the map files in the specified directory

Parameters:

Name Type Description Default
map_file_directory str

The map file directory path

required
market str

The map file market

required
security_type SecurityType

The map file security type

required
data_provider IDataProvider

The data provider instance to use

required

Returns:

Type Description
Iterable[MapFile]

An enumerable of all map files.

get_mapped_symbol

get_mapped_symbol(
    search_date: Union[datetime, date],
    default_return_value: str = ...,
    data_mapping_mode: Optional[DataMappingMode] = None,
) -> str

Memory overload search method for finding the mapped symbol for this date.

Parameters:

Name Type Description Default
search_date Union[datetime, date]

date for symbol we need to find.

required
default_return_value str

Default return value if search was got no result.

...
data_mapping_mode Optional[DataMappingMode]

The mapping mode to use if any.

None

Returns:

Type Description
str

Symbol on this date.

get_relative_map_file_path

get_relative_map_file_path(
    market: str, security_type: SecurityType
) -> str

Constructs the map file path for the specified market and symbol

Parameters:

Name Type Description Default
market str

The market this symbol belongs to

required
security_type SecurityType

The map file security type

required

Returns:

Type Description
str

The file path to the requested map file.

has_data

has_data(date: Union[datetime, date]) -> bool

Determines if there's data for the requested date

to_csv_lines

to_csv_lines() -> Iterable[str]

Reads and writes each MapFileRow

Returns:

Type Description
Iterable[str]

Enumerable of csv lines.

write_to_csv

write_to_csv(
    market: str, security_type: SecurityType
) -> None

Writes the map file to a CSV file

Parameters:

Name Type Description Default
market str

The market to save the MapFile to

required
security_type SecurityType

The map file security type

required