-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFMP.py
31 lines (24 loc) · 968 Bytes
/
FMP.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import requests
import certifi
from urllib.request import urlopen
import json
class FMP:
def __init__(self, token, symbol):
self.BASE_URL = 'https://financialmodelingprep.com/api/v3'
self.token = token
self.symbol = symbol
def get_DCF(self):
url = f'{self.BASE_URL}/company/discounted-cash-flow/{self.symbol}?apikey={self.token}'
return url
def get_fundamental_ratios(self):
url = f'{self.BASE_URL}/ratios/{self.symbol}?apikey={self.token}'
return url
def get_company_profile(self):
url = f'{self.BASE_URL}/profile/{self.symbol}?apikey={self.token}'
return url
def get_marketcap(self):
url = f'{self.BASE_URL}/market-capitalization/{self.symbol}?apikey={self.token}'
return url
def get_hourly_stockprice(self):
url = f'{self.BASE_URL}/historical-chart/1hour/{self.symbol}?apikey={self.token}'
return url