### Install Hatch and Build Dependencies Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Installs Hatch and other necessary build tools using pip. Ensure Hatch is installed following its official documentation. ```shell pip install hatch hatch-containers coverage black responses ``` -------------------------------- ### Install EarningsCall Python Library Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Install or upgrade the EarningsCall Python package using pip. This command is for users who want to utilize the library. ```sh pip install --upgrade earningscall ``` -------------------------------- ### Save Server Responses for Mocking Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Uses the `responses` library to record server responses to YAML files for use in mocked unit tests. Ensure the `responses` library is installed. ```python import requests from responses import _recorder @_recorder.record(file_path="symbols.yaml") def test_save_symbols_v1(): requests.get("https://earningscall.biz/symbols.txt") @_recorder.record(file_path="symbols-v2.yaml") def test_save_symbols_v1(): requests.get("https://earningscall.biz/symbols-v2.txt") ``` -------------------------------- ### Run Script to Get All Company Transcripts Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Manually runs a Python script to retrieve all earnings call transcripts for a specified company. ```shell python -m scripts.get_all_company_transcripts ``` -------------------------------- ### Get Prepared Remarks and Q&A Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Retrieve the prepared remarks and Q&A sections for a specific quarter by setting the 'level' parameter to 4. This functionality requires Enhanced Transcript Data. ```python from earningscall import get_company company = get_company("aapl") # Lookup Apple, Inc by its ticker symbol, "AAPL" transcript = company.get_transcript(year=2021, quarter=3, level=4) print(f"{company} Q3 2021 Prepared Remarks: \"{transcript.prepared_remarks[:100]}...\"") print(f"{company} Q3 2021 Q&A: \"{transcript.questions_and_answers[:100]}...\"") ``` -------------------------------- ### Publish New Version to PyPI Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Commands to commit changes, tag a new version, and push the tag to the remote repository for publishing to PyPI. Assumes version 0.0.7 as an example. ```shell git commit -a git tag v0.0.7 git push --atomic origin master v0.0.7 ``` -------------------------------- ### Get Earnings Event Calendar Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Retrieves a list of earnings events for a specific date. It prints company name, quarter, year, conference date, and transcript readiness. ```python from datetime import date from earningscall import get_calendar calendar = get_calendar(date(2025, 1, 10)) for event in calendar: print(f"{event.company_name} - Q{event.quarter} {event.year} on: {event.conference_date.astimezone().isoformat()} Transcript Ready: {event.transcript_ready}") ``` -------------------------------- ### Run Script to Get Single Transcript Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Manually runs a Python script to fetch a single earnings call transcript from the API. ```shell python -m scripts.get_single_transcript ``` -------------------------------- ### Get Word-Level Timestamps Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Obtain word-level timestamps for a transcript by setting the 'level' parameter to 3. Each timestamp indicates the number of seconds since the start of the transcript. This feature requires Enhanced Transcript Data. ```python from earningscall import get_company company = get_company("aapl") # Lookup Apple, Inc by its ticker symbol, "AAPL" transcript = company.get_transcript(year=2021, quarter=3, level=3) first_speaker = transcript.speakers[0] words_and_start_times = list(zip(first_speaker.words, first_speaker.start_times)) print(f"Speaker: {first_speaker.speaker}") print(f"Words with start times: {words_and_start_times}") ``` -------------------------------- ### Get Speaker Name, Title, and Text Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Retrieve the second speaker's name, title, and the text they spoke from a transcript. Requires the 'earningscall' library and a company lookup. ```python from earningscall import get_company company = get_company("aapl") # Lookup Apple, Inc by its ticker symbol, "AAPL" transcript = company.get_transcript(year=2021, quarter=3, level=2) speaker = transcript.speakers[1] # Get second speaker speaker_label = speaker.speaker_info.name text = speaker.text print("Speaker:") print(f" Name: {speaker.speaker_info.name}") print(f" Title: {speaker.speaker_info.title}") print() print(f"Text: {text}") ``` -------------------------------- ### Get All Transcripts for a Company Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Fetch all available earnings call transcripts for a given company. It iterates through company events and retrieves transcripts, skipping future conference dates. ```python from datetime import datetime from earningscall import get_company company = get_company("aapl") # Lookup Apple, Inc by its ticker symbol, "AAPL" print(f"Getting all transcripts for: {company}..") # Retrieve all earnings conference call events for a company, and iterate through each one for event in company.events(): if datetime.now().timestamp() < event.conference_date.timestamp(): print(f"* {company.company_info.symbol} Q{event.quarter} {event.year} -- skipping, conference date in the future") continue transcript = company.get_transcript(event=event) # Fetch the earnings call transcript for this event print(f"* Q{event.quarter} {event.year}") if transcript: print(f" Transcript Text: \"{transcript.text[:100]}...\"") else: print(f" No transcript found.") ``` -------------------------------- ### Get Transcript for a Single Quarter Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Retrieve the earnings call transcript for a specific company and quarter. Requires the company ticker symbol, year, and quarter. ```python from earningscall import get_company company = get_company("aapl") # Lookup Apple, Inc by its ticker symbol, "AAPL" transcript = company.get_transcript(year=2021, quarter=3) print(f"{company} Q3 2021 Transcript Text: \"{transcript.text[:100]}...\"\"") ``` -------------------------------- ### Get Text by Speaker from Transcript Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Extract text spoken by a specific speaker from an earnings call transcript. This requires the transcript data to be at level 2, which is available in plans with Enhanced Transcript Data. ```python from earningscall import get_company company = get_company("aapl") # Lookup Apple, Inc by its ticker symbol, "AAPL" transcript = company.get_transcript(year=2021, quarter=3, level=2) first_speaker = transcript.speakers[0] speaker_label = first_speaker.speaker text = first_speaker.text print(f"Speaker: {speaker_label}\nText: {text}") ``` -------------------------------- ### Build the Project Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Builds the project using Hatch. This command compiles and packages the library. ```shell hatch build ``` -------------------------------- ### Run Unit Tests Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Executes all unit tests for the project using Hatch. This is a standard step to ensure code correctness. ```shell hatch run test ``` -------------------------------- ### Download Audio File Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Download the audio file for a specific quarter using the `download_audio_file` function. Specify the company, year, quarter, and desired file name. ```python from earningscall import get_company company = get_company("aapl") # Lookup Apple, Inc by its ticker symbol, "AAPL" print("Downloading audio file for Apple Inc. Q3 2021...") audio_file = company.download_audio_file(year=2021, quarter=3, file_name="Apple-Q3-2021.mp3") print(f"Downloaded audio file to: {audio_file}") ``` -------------------------------- ### Run Linter Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Runs the linter across all code files to check for style and potential errors using Hatch. ```shell hatch run lint:all ``` -------------------------------- ### Run Container Tests Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Executes all unit tests within a containerized environment using Hatch. This simulates different Python versions and ensures compatibility. ```shell hatch run all:test ``` -------------------------------- ### Run Script to List All Companies Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Manually runs a Python script to list all available companies for which earnings call data can be retrieved. ```shell python -m scripts.list_companies ``` -------------------------------- ### Download Company Slide Deck Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Downloads the slide deck for a specific company and year/quarter. The filename can be specified. ```python from earningscall import get_company company = get_company("MSFT") # Lookup Microsoft by its ticker symbol, "MSFT" slide_deck_filename = company.download_slide_deck(year=2025, quarter=1, file_name="Microsoft-Q1-2025-Slides.pdf") print(f"Downloaded slide deck to: {slide_deck_filename}") ``` -------------------------------- ### Run Test Coverage Report Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Generates a test coverage report using Hatch. This helps identify parts of the code not covered by tests. ```shell hatch run cov ``` -------------------------------- ### Default Retry Strategy Configuration Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Shows the default configuration for the library's retry strategy, which uses exponential backoff for handling rate limiting and HTTP errors. ```python import earningscall earningscall.retry_strategy = { "strategy": "exponential", "base_delay": 1, "max_attempts": 10, } ``` -------------------------------- ### Linear Retry Strategy Configuration Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Configures the library to use a linear retry strategy with a specified base delay and maximum attempts. ```python import earningscall earningscall.retry_strategy = { "strategy": "linear", "base_delay": 1, "max_attempts": 3, } ``` -------------------------------- ### Format Code with Linter Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Automatically fixes linter errors and formats the code according to project standards using Hatch. ```shell hatch run lint:fmt ``` -------------------------------- ### Generate HTML Coverage Report Source: https://github.com/earningscall/earningscall-python/blob/master/DEVELOPMENT.md Generates an HTML version of the test coverage report locally. This provides a more interactive way to view coverage details. ```shell coverage html ``` -------------------------------- ### List All Companies Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Retrieves and prints information for all available companies, including their sector and industry. Access to a larger dataset requires an API key. ```python from earningscall import get_all_companies for company in get_all_companies(): print(f"{company.company_info} -- {company.company_info.sector} -- {company.company_info.industry}") ``` -------------------------------- ### Set API Key Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Sets the API key for accessing premium features of the EarningsCall library. This can be done directly in the script. ```python import earningscall earningscall.api_key = "YOUR-SECRET-API-KEY-GOES-HERE" ``` -------------------------------- ### List S&P 500 Companies Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Retrieves and prints information for companies within the S&P 500 index, including their sector and industry. ```python from earningscall import get_sp500_companies for company in get_sp500_companies(): print(f"{company.company_info} -- {company.company_info.sector} -- {company.company_info.industry}") ``` -------------------------------- ### Disable Request Caching Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Disables the local caching of metadata retrieved from the EarningsCall API to speed up subsequent requests. ```python import earningscall earningscall.enable_requests_cache = False ``` -------------------------------- ### Disable Retries Source: https://github.com/earningscall/earningscall-python/blob/master/README.md Disables the retry mechanism by setting the maximum number of attempts to 1, ensuring only a single request attempt. ```python import earningscall earningscall.retry_strategy = { "strategy": "exponential", "base_delay": 1, "max_attempts": 1, } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.