mirror of
https://github.com/andrewkdinh/fund-indicators.git
synced 2024-11-21 18:04:19 -08:00
Update StockData.py
This commit is contained in:
parent
f0d0fccf8b
commit
188e095961
10
StockData.py
10
StockData.py
@ -13,6 +13,7 @@ apiBarchart = 'a17fab99a1c21cd6f847e2f82b592838'
|
|||||||
apiTiingo = '2e72b53f2ab4f5f4724c5c1e4d5d4ac0af3f7ca8' # Limited to 400 requests/day
|
apiTiingo = '2e72b53f2ab4f5f4724c5c1e4d5d4ac0af3f7ca8' # Limited to 400 requests/day
|
||||||
|
|
||||||
import requests, json
|
import requests, json
|
||||||
|
import importlib.util, sys # To check whether a package is installed
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
class Stock:
|
class Stock:
|
||||||
@ -407,6 +408,12 @@ class Stock:
|
|||||||
return finalDatesAndClose
|
return finalDatesAndClose
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
|
|
||||||
|
package_name = 'requests'
|
||||||
|
spec = importlib.util.find_spec(package_name)
|
||||||
|
if spec is None:
|
||||||
|
print(package_name +" is not installed\nPlease type in 'pip install -r requirements.txt' to install all required packages")
|
||||||
|
|
||||||
# Makes list with ['firstDate', 'lastDate', [allDates], values]
|
# Makes list with ['firstDate', 'lastDate', [allDates], values]
|
||||||
|
|
||||||
listOfFirstLastDates = []
|
listOfFirstLastDates = []
|
||||||
@ -426,12 +433,13 @@ class Stock:
|
|||||||
self.allLists.append(listAV)
|
self.allLists.append(listAV)
|
||||||
|
|
||||||
# COMMENTED OUT FOR NOW B/C LIMITED TO 400 REQUESTS/DAY
|
# COMMENTED OUT FOR NOW B/C LIMITED TO 400 REQUESTS/DAY
|
||||||
|
'''
|
||||||
print("\nTiingo")
|
print("\nTiingo")
|
||||||
listTiingo = Stock.getTiingo(self)
|
listTiingo = Stock.getTiingo(self)
|
||||||
#print(listTiingo)
|
#print(listTiingo)
|
||||||
listOfFirstLastDates.append((listTiingo[0], listTiingo[1]))
|
listOfFirstLastDates.append((listTiingo[0], listTiingo[1]))
|
||||||
self.allLists.append(listTiingo)
|
self.allLists.append(listTiingo)
|
||||||
|
'''
|
||||||
|
|
||||||
#print(self.allLists)
|
#print(self.allLists)
|
||||||
#print(listOfFirstLastDates)
|
#print(listOfFirstLastDates)
|
||||||
|
Loading…
Reference in New Issue
Block a user