Created
July 29, 2021 02:39
-
-
Save McKlayne/49e1b00e5891de38d18b3a44350c8754 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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