Parser

Starting in version 0.3.0, secedgar will start to implement a general-purpose parser.

This is expected to be an ambitious task and may not be feasible for all filing types. However, given user feedback, we feel that it is worth a shot. Please note that parsing will remain experimental for the foreseeable future.

Parsing Meta Data

class secedgar.parser.MetaParser

Utility class to extract metadata and documents from a single text file.

Warning

The MetaParser class is still experimental. Use with caution.

New in version 0.3.0.

process(infile, out_dir=None, create_subdir=True, rm_infile=False)

Process a text file and save processed files.

Parameters:
  • infile (str) – Full path to a text file.

  • out_dir (str) – Directory to store output files. Defaults to the parent directory of infile.

  • create_subdir (bool) – If a subdirectory with the name of the infile should be created. If this is not true, files will be prefixed with the infile filename.

  • rm_infile (bool) – If the infile should be removed after processing. Defaults to False.

Returns:

None

static process_document_metadata(doc)

Process the metadata of an embedded document.

Parameters:

doc (str) – Document to extract meta data from.

Returns:

Dictionary with fields parsed from document.

Return type:

dict

static process_metadata(curr_doc)

Process the metadata of the focal document.

Parameters:

curr_doc (str) – Process meta data for single focal document.

Returns:

Meta data from focal document.

Return type:

out_dict (dict)

Parsing Form 4 Data

class secedgar.parser.F4Parser

Utility class to extract actionable data and documents from a single text file.

Warning

The F4Parser class is still experimental. Use with caution.

New in version 0.4.0.

static process(doc)

Process the actionable data of the document.

Parameters:

doc (str) – Document from which to extract core data.

Returns:

Tradable buy/sell/gift data from document.

Return type:

data (dict)