IEX API working
This commit is contained in:
parent
dbc750ed67
commit
5db785d662
@ -100,7 +100,7 @@ def updateUpdate(NY_time):
|
||||
f.write(NY_str + '\n')
|
||||
f.close()
|
||||
|
||||
def updateStockPrices():
|
||||
def updateStockPricesFinhubb():
|
||||
max_stocks = 200
|
||||
finnhubsandboxAPIkey = "sandbox_c24qddqad3ickpckgg8g" #Finnhub
|
||||
finnhubAPIkey = "c24qddqad3ickpckgg80" #Finnhub
|
||||
@ -136,7 +136,7 @@ def updateStockPrices():
|
||||
print(e)
|
||||
|
||||
|
||||
def updateStockPricesIEX():
|
||||
def updateStockPrices():
|
||||
|
||||
iexAPIkey = 'pk_68ef6a15902c41f887f0b544a0ca17cf' #IEX
|
||||
iexSandboxAPIkey = 'Tpk_0078dff413ef4f979137f7111452dc4b'
|
||||
@ -188,14 +188,22 @@ def updateStockPricesIEX():
|
||||
print('Response code: \n',intraday_response)
|
||||
|
||||
|
||||
print(intraday_response.text)
|
||||
#print(intraday_response.text)
|
||||
|
||||
opn = intraday_response.json()[0]['open']
|
||||
current = intraday_response.json()[-1]['close']
|
||||
for i in range(len(intraday_response.json())):
|
||||
opn = intraday_response.json()[i]['open']
|
||||
print(opn)
|
||||
if opn is not None:
|
||||
break
|
||||
for i in range(len(intraday_response.json())-1, 0, -1):
|
||||
|
||||
current = intraday_response.json()[i]['close']
|
||||
if current is not None:
|
||||
break
|
||||
|
||||
opening_prices.append(opn)
|
||||
current_prices.append(current)
|
||||
|
||||
print(opn, current)
|
||||
'''
|
||||
for time_point in intraday_response.json():
|
||||
print(time_point['date'])
|
||||
@ -609,6 +617,8 @@ if __name__ == '__main__':
|
||||
#json.dump(update_times, f)
|
||||
#f.close()
|
||||
|
||||
|
||||
|
||||
try:
|
||||
f = open('csv/last_updates.json', 'r')
|
||||
last_updates = json.load(f)
|
||||
|
@ -1,4 +1,4 @@
|
||||
name,current,opening
|
||||
MSFT,276.845,278.03
|
||||
NFLX,541.92,533
|
||||
GOOG,2589.7622,2588.99
|
||||
MSFT,277.355,278.02
|
||||
NFLX,542.15,532.56
|
||||
GOOG,2595.72,2588.01
|
||||
|
|
Loading…
Reference in New Issue
Block a user