Package Functions

iex_parser.parse_date(date_str: str, download_dir: str, parsed_folder: str, symbol: str, download: bool = True, split: bool = False)[source]

This function (can) download and parse the IEXTP1 DEEP1.0 pcap files for a given date.

Parameters:

date_str (str): The date string to be parsed. Format YYYY-MM-DD

download_dir (str): The directory where the files are downloaded.

parsed_folder (str): The directory where the parsed output should be saved.

symbol (str): Path to a txt file with symbols to parse. Must have one symbol per line. If “ALL”, all symbols are parsed.

download (bool): Whether to download the files. Default is True.

split (bool): Whether to split the output files. One file per letter of the anphabet is generated. Default is False.

Returns:

None

iex_parser.parse_dates(start_date: str, end_date: str, download_dir: str, parsed_folder: str, symbol: str, download: bool = False, split: bool = False)[source]

This function parses a range of dates and (downloads and) parses the corresponding IEXTP1 DEEP1.0 pcap files.

Parameters:

start_date (str): The start date string in the format YYYY-MM-DD.

end_date (str): The end date string in the format YYYY-MM-DD.

download_dir (str): The directory where the files are downloaded.

parsed_folder (str): The directory where the parsed output should be saved.

symbol (str): Path to a txt file with symbols to parse. Must have one symbol per line. If “ALL”, all symbols are parsed.

download (bool): Whether to download the files. Default is False.

split (bool): Whether to split the output files. One file per letter of the anphabet is generated. Default is False.

Returns:

None

iex_parser.parse_file(file_path: str, parsed_folder: str, symbol: str, split: bool = False)[source]

This function parses a file using the IEX parser and redirects the output to a specified folder.

Parameters:

file_path (str): The path to the file to be parsed.

parsed_folder (str): The path to the folder where the parsed output should be saved.

symbol (str): Path to a txt file with symbols to parse. Must have one symbol per line. If “ALL”, all symbols are parsed.

split (bool): Whether to split the output files. One file per letter of the anphabet is generated. Default is False.

Returns:

None

iex_parser.valid_date(s: str) str[source]

This function checks if a given string represents a valid date in the format YYYY-MM-DD.

Parameters:

s (str): The string to be checked.

Returns:

s (str): The input string if it represents a valid date, otherwise raises an error.

iex_parser.download.download_hist_file(date: str, download_dir: str) bool[source]

Checks the hist_data JSON file for a specific file and downloads it if it doesn’t exist.

Parameters:

date (str): The date in the format YYYYMMDD.

download_dir (str): The directory to download the file to.

Returns:

bool: True if the file was downloaded or already existed, False otherwise.

iex_parser.download.get_hist_data(date: str)[source]

Retrieves the historical data available on IEX (https://iextrading.com/api/1.0/hist) and parses it as JSON.

Parameters:

date (str): The date in the format YYYYMMDD.

Returns:

dict: The parsed JSON data for the required date.