capiq_excel package

Submodules

capiq_excel.addin module

capiq_excel.addin.load_capiq(excel)[source]

capiq_excel.combine module

capiq_excel.combine.combine_all_capiq_xlsx(infolder, outpath, restart=True, num_parts=100)[source]

capiq_excel.exceptions module

exception capiq_excel.exceptions.CapitalIQInactiveException[source]

Bases: Exception

exception capiq_excel.exceptions.WorkbookClosedException[source]

Bases: Exception

capiq_excel.fileops module

capiq_excel.fileops.get_path_of_additional_failed_folder_add_if_necessary(orig_folder)[source]
capiq_excel.fileops.get_path_of_failed_folder_add_if_necessary(orig_folder)[source]
capiq_excel.fileops.move_file_to_failed_folder(file, failed_folder, retries_remaining=100)[source]

capiq_excel.ids module

capiq_excel.ids.combine_all_capiq_ids_xlsx(infolder, outpath, restart=True)[source]
capiq_excel.ids.download_capiq_ids(ids, outpath='capiq ids.csv', folder='in_process_ids')[source]

Downloads Capital IQ identifiers when passed other identifiers such as CUSIP, ISIN, ticker, name, etc.

Stores in a CSV with matched names included and also returns capiq ids as a list

Parameters
  • ids (Sequence[str]) – identifiers such as CUSIP, ISIN, ticker, name. Can be a mixture.

  • folder (str) – folder which will hold in process files

  • outpath (str) – filepath to output csv, including file extension

Return type

List[str]

Returns

capiq ids

capiq_excel.ids.populate_all_ids_in_folder(folder, restart=True)[source]

capiq_excel.main module

capiq_excel.main.download_data(company_ids, financial_data_items=None, market_data_items=None, ids_folder='in_process_ids', data_folder='in_process_data', data_outpath='capiq data.csv', ids_outpath='capiq ids.csv', restart=True, timeout=240, run_failed=False, **financial_command_kwargs)[source]

Downloads data from Capital IQ given arbitrary ids such as name, ticker, CUSIP, ISIN, etc.

Parameters
  • company_ids (List[str]) –

  • financial_data_items (Union[Dict[str, str], Sequence[str], None]) – Financial data items to pull for companies. Only pass variables which show up on the Financial Data tab in the formula builder. keys are variable names in capital iq, values are what the names should be in the output data. e.g. {‘IQ_TOTAL_REVENUE’: ‘Sales’}. If wanting to use the original names from Capital IQ, simply a list may be passed, e.g. [‘IQ_TOTAL_REVENUE’]

  • market_data_items (Union[Dict[str, str], Sequence[str], None]) – Market data items to pull for companies. Only pass variables which show up on the Market Data tab in the formula builder. Format is the same as financial_data_items

  • ids_folder (str) – Location for in-process files for getting ids

  • data_folder (str) – Location for in-process files for getting data

  • data_outpath (str) – Path to csv where final data should be outputted

  • ids_outpath (str) – Path to csv where Capital IQ ids should be outputted

  • restart (bool) – If not the first run, start over from the beginning. Set to False to start from where left off

  • timeout (int) – Time to wait for file to be populated before considering it failed

  • run_failed (bool) – Should only be set to True on a second or later run. Will target the failed files instead of the main files if True is passed.

  • financial_command_kwargs – kwargs for financial_data_command()

Returns

capiq_excel.main.download_data_for_capiq_ids(capiq_company_ids, financial_data_items=None, market_data_items=None, folder='in_process_data', outpath='capiq data.csv', restart=True, timeout=240, run_failed=False, **financial_command_kwargs)[source]

Downloads data from Capital IQ given the capital IQ ids and chosen variables

Parameters
  • capiq_company_ids (List[str]) – Capital IQ ids for companies, e.g. [‘IQ4564656’, ‘IQ45643215’]

  • financial_data_items (Union[Dict[str, str], Sequence[str], None]) – Financial data items to pull for companies. Only pass variables which show up on the Financial Data tab in the formula builder. keys are variable names in capital iq, values are what the names should be in the output data. e.g. {‘IQ_TOTAL_REVENUE’: ‘Sales’}. If wanting to use the original names from Capital IQ, simply a list may be passed, e.g. [‘IQ_TOTAL_REVENUE’]

  • market_data_items (Union[Dict[str, str], Sequence[str], None]) – Market data items to pull for companies. Only pass variables which show up on the Market Data tab in the formula builder. Format is the same as financial_data_items

  • folder (str) – Location for in-process files

  • outpath (str) – Path to csv where final data should be outputted

  • restart (bool) – If not the first run, start over from the beginning. Set to False to start from where left off

  • timeout (int) – Time to wait for file to be populated before considering it failed

  • run_failed (bool) – Should only be set to True on a second or later run. Will target the failed files instead of the main files if True is passed.

  • financial_command_kwargs – kwargs for financial_data_command()

Returns

Module contents