How to get company earning announcements data api?

Question:

I want to get real-time earning annoouncements data api.
I tried yfinance but it doesn’t work currently.

So is there any other replacement api?
Most of API need to pay money, But I just want to try for my personal projects so it’s little pressured

Does Yahoo Finance no longer offer api? I heard that yfinance is not yahoo finance api.

I tried yfinance, yahooquery, other API’s

I want real-time earning announcements data api

Asked By: 권승빈

||

Answers:

Alphavantage: https://www.alphavantage.co/#page-top

Alphavantage has an awesome API with finance information and best part is it is completely free to get an API key.

import requests

api_key = ''#your api key

symbol = 'AAPL'# symbol of stock/company

url = f'https://www.alphavantage.co/query?function=EARNINGS&symbol={symbol}&apikey={api_key}'

response = requests.get(url)

if response.status_code == 200:
    data = response.json()

    earnings_announcements = data['quarterlyEarnings']

    for announcement in earnings_announcements:
        report_date = announcement['reportedDate']
        eps_estimate = announcement['estimatedEPS']
        eps_actual = announcement['reportedEPS']
        fiscal_period = announcement['fiscalDateEnding']

        print(f"Report Date: {report_date}")
        print(f"EPS Estimate: {eps_estimate}")
        print(f"EPS Actual: {eps_actual}")
        print(f"Fiscal Period: {fiscal_period}")
        print()
else:
    print("Error occurred while fetching earnings announcements.")
Answered By: Flow