Esempio n. 1
0
    response = urlopen(url)
    data = response.read().decode("utf-8")
    return json.loads(data)


# inputs
base_url = "https://financialmodelingprep.com/api/v3/"
tickers = [
    'AAL', 'ACGL', 'AEM', 'ALSN', 'AMX', 'APPS', 'BKNG', 'BLD', 'BX', 'CMG',
    'CSL', 'DIOD', 'DOMO', 'DOYU', 'EDU', 'EHC', 'ENPH', 'ESGR', 'EXPI', 'FUN',
    'FUTU', 'HAE', 'HSIC', 'IBN', 'IBP', 'ISRG', 'JD', 'KKR', 'KNSL', 'LAMR',
    'LNG', 'LULU', 'MA', 'MGM', 'MRVL', 'NCR', 'NFLX', 'NIO', 'NIU', 'OLED',
    'PAGS', 'PCRX', 'RCM', 'REGI', 'SBSW', 'SGMS', 'SPWR', 'SQ', 'SYF', 'WKHS',
    'WYND', 'XP', 'XRX', 'YY'
]
apiKey = financial_model_prep()

cash_flows = []
total_debts = []
cash_and_ST_investments_list = []
betas = []
discount_rates = []
EPS_growth_5Ys = []
EPS_growth_6Y_to_10Ys = []
EPS_growth_11Y_to_20Ys = []
shares_outstandings = []
intrinsic_values = []
current_prices = []
margins_safety = []
valid_tickers = []
Esempio n. 2
0
import requests
from config import financial_model_prep
import pandas as pd

demo = financial_model_prep()

symbols = pd.read_pickle('spxTickers.pickle')
DivYield = {}

for company in symbols:
  try:
    companydata = requests.get(f'https://fmpcloud.io/api/v3/profile/{company}?apikey={demo}')
    companydata = companydata.json()
    latest_Annual_Dividend = companydata[0]['lastDiv']
    price = companydata[0]['price']
    market_Capitalization = companydata[0]['mktCap']
    name = companydata[0]['companyName']
    exchange = companydata[0]['exchange']

    dividend_Yield= latest_Annual_Dividend/price
    DivYield[company] = {}
    DivYield[company]['Dividend_Yield'] = dividend_Yield
    DivYield[company]['latest_Price'] = price
    DivYield[company]['latest_Dividend'] = latest_Annual_Dividend
    DivYield[company]['market_Capit_in_M'] = market_Capitalization/1000000
    DivYield[company]['company_Name'] = name
    DivYield[company]['exchange'] = exchange
  except:
    pass

DivYield_dataframe = pd.DataFrame.from_dict(DivYield, orient='index')