Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save McKlayne/49e1b00e5891de38d18b3a44350c8754 to your computer and use it in GitHub Desktop.
Save McKlayne/49e1b00e5891de38d18b3a44350c8754 to your computer and use it in GitHub Desktop.
from io import BytesIO
import requests
import time
import pandas as pd
def earnings_history_api(api_key, symbol):
assert symbol is not None
symbol = symbol.strip().upper()
url = f"{BASE_URL}function=EARNINGS&symbol={symbol}&apikey={api_key}"
response = requests.get(url)
return pd.DataFrame(response.json()['quarterlyEarnings'])
earnings_history_api(API_KEY, "FB")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment