import requests
import json
import pandas as pd
# retrieve alpaca keys
%run alpaca_keys.py
ticker = 'MSFT'
request_string = (
f'https://api.polygon.io/v2/reference/'
f'financials/{ticker}?apiKey={KEY_ID}'
)
msft_financials_df = pd.DataFrame(
requests.get(request_string).json()['results']
)
columns = ['ticker', 'calendarDate', 'freeCashFlow', 'enterpriseValue', 'grossProfit']
msft_financials_df[columns].head()