Skip to content

Commit

Permalink
remove exact_search
Browse files Browse the repository at this point in the history
  • Loading branch information
opskov committed Mar 3, 2024
1 parent 5f86aa1 commit 3ad45ab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,14 @@ python main.py text_search --help
# Basic usage (defaults to searching the last 5 years of records)
python main.py text_search John Doe

# Basic usage with a combination of exact and partial search parameters
python main.py text_search \"John Doe\" Pharmaceuticals Chemicals

# Usage with date range and export to custom CSV file
python main.py text_search Tsunami Hazards --start_date "2021-01-01" --end_date "2021-12-31" --output "results.csv"

# More advanced usage specifying more arguments, with export to JSON
python main.py text_search Volcano Monitoring --start_date "2021-01-01" --end_date "2021-12-31" --exact_search --output "results.json"\
python main.py text_search Volcano Monitoring --start_date "2021-01-01" --end_date "2021-12-31" --output "results.json"\
--filing_type "all_annual_quarterly_and_current_reports" --entity_id "0001030717" \
--min_wait 5.0 --max_wait 7.0 --retries 3 --browser "firefox" --headless

Expand Down
4 changes: 0 additions & 4 deletions src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def text_search(
output: str = f"edgar_search_results_{datetime.now().strftime('%d%m%Y_%H%M%S')}.csv",
entity_id: Optional[str] = None,
filing_type: Optional[str] = None,
exact_search: bool = False,
start_date: str = (date.today() - timedelta(days=365 * 5)).strftime("%Y-%m-%d"),
end_date: str = date.today().strftime("%Y-%m-%d"),
min_wait: float = 5.0,
Expand All @@ -78,7 +77,6 @@ def text_search(
:param output: Name of the output file to save the results to
:param entity_id: CIK or name or ticker of the company to search for
:param filing_type: Type of filing to search for
:param exact_search: Whether to exactly match the sequence of keywords or not
:param start_date: Start date of the search
:param end_date: End date of the search
:param min_wait: Minimum wait time for the request to complete before checking the page or retrying a request
Expand All @@ -89,7 +87,6 @@ def text_search(
"""
try:
keywords = list(keywords)
exact_search = bool(exact_search)
start_date = datetime.strptime(start_date, "%Y-%m-%d")
end_date = datetime.strptime(end_date, "%Y-%m-%d")
min_wait = float(min_wait)
Expand All @@ -115,7 +112,6 @@ def text_search(
keywords=keywords,
entity_id=entity_id,
filing_type=filing_type,
exact_search=exact_search,
start_date=start_date,
end_date=end_date,
min_wait_seconds=min_wait,
Expand Down
10 changes: 0 additions & 10 deletions src/text_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ def _generate_request_args(
keywords: List[str],
entity_id: Optional[str],
filing_type: Optional[str],
exact_search: bool,
start_date: date,
end_date: date,
page_number: int,
Expand All @@ -200,7 +199,6 @@ def _generate_request_args(
:param keywords: Search keywords to input in the "Document word or phrase" field
:param entity_id: Entity/Person name, ticker, or CIK number to input in the "Company name, ticker, or CIK" field
:param filing_type: Filing category to select from the dropdown menu, defaults to None
:param exact_search: Whether to perform an exact search on the search_keywords argument or not, defaults to False in order to return the maximum amount of search results by default
:param start_date: Start date for the custom date range, defaults to 5 years ago to replicate the default behavior of the SEC website
:param end_date: End date for the custom date range, defaults to current date in order to replicate the default behavior of the SEC website
:param page_number: Page number to request, defaults to 1
Expand All @@ -214,7 +212,6 @@ def _generate_request_args(

# Join search keywords into a single string
keywords = " ".join(keywords)
keywords = f'"{keywords}"' if exact_search else keywords

# Generate request arguments
request_args = {
Expand Down Expand Up @@ -310,7 +307,6 @@ def _generate_search_requests(
keywords: List[str],
entity_id: Optional[str],
filing_type: Optional[str],
exact_search: bool,
start_date: date,
end_date: date,
min_wait_seconds: float,
Expand All @@ -324,7 +320,6 @@ def _generate_search_requests(
:param keywords: Search keywords to input in the "Document word or phrase" field
:param entity_id: Entity/Person name, ticker, or CIK number to input in the "Company name, ticker, or CIK" field
:param filing_type: Filing category to select from the dropdown menu
:param exact_search: Whether to perform an exact search on the search_keywords argument or not
:param start_date: Start date for the custom date range
:param end_date: End date for the custom date range
:param min_wait_seconds: Minimum number of seconds to wait for the request to complete
Expand All @@ -337,7 +332,6 @@ def _generate_search_requests(
keywords=keywords,
entity_id=entity_id,
filing_type=filing_type,
exact_search=exact_search,
start_date=start_date,
end_date=end_date,
page_number=1,
Expand Down Expand Up @@ -385,7 +379,6 @@ def _generate_search_requests(
keywords=keywords,
entity_id=entity_id,
filing_type=filing_type,
exact_search=exact_search,
start_date=start,
end_date=end,
min_wait_seconds=min_wait_seconds,
Expand All @@ -400,7 +393,6 @@ def text_search(
keywords: List[str],
entity_id: Optional[str],
filing_type: Optional[str],
exact_search: bool,
start_date: date,
end_date: date,
min_wait_seconds: float,
Expand All @@ -414,7 +406,6 @@ def text_search(
:param keywords: Search keywords to input in the "Document word or phrase" field
:param entity_id: Entity/Person name, ticker, or CIK number to input in the "Company name, ticker, or CIK" field
:param filing_type: Filing category to select from the dropdown menu
:param exact_search: Whether to perform an exact search on the search_keywords argument or not
:param start_date: Start date for the custom date range
:param end_date: End date for the custom date range
:param min_wait_seconds: Minimum number of seconds to wait for the request to complete
Expand All @@ -427,7 +418,6 @@ def text_search(
keywords=keywords,
entity_id=entity_id,
filing_type=filing_type,
exact_search=exact_search,
start_date=start_date,
end_date=end_date,
min_wait_seconds=min_wait_seconds,
Expand Down

0 comments on commit 3ad45ab

Please sign in to comment.