May-24-2019, 06:34 AM
Quotes from iextrading.com:
#!/usr/bin/python3 import requests tic = "ibm" url = "https://api.iextrading.com/1.0/stock/" + tic + "/quote" rsp = requests.get(url) if rsp.status_code in (200,): ustr = rsp.text.strip() print(ustr) else: print("ERROR:", rsp.status_code) print(rsp.text)
Output:{"symbol":"IBM","companyName":"International Business Machines Corporation","primaryExchange":"New York Stock Exchange","sector":"Technology","calculationPrice":"close","open":135,"openTime":1558618233304,"close":132.39,"closeTime":1558641720610,"high":135.13,"low":130.44,"latestPrice":132.39,"latestSource":"Close","latestTime":"May 23, 2019","latestUpdate":1558641720610,"latestVolume":5236513,"iexRealtimePrice":132.41,"iexRealtimeSize":35,"iexLastUpdated":1558641594136,"delayedPrice":132.39,"delayedPriceTime":1558641720610,"extendedPrice":132.28,"extendedChange":-0.11,"extendedChangePercent":-0.00083,"extendedPriceTime":1558644319071,"previousClose":136.35,"change":-3.96,"changePercent":-0.02904,"iexMarketPercent":0.04697,"iexVolume":245959,"avgTotalVolume":3859335,"iexBidPrice":0,"iexBidSize":0,"iexAskPrice":0,"iexAskSize":0,"marketCap":117382649956,"peRatio":9.58,"week52High":154.36,"week52Low":105.94,"ytdChange":0.14727588066422426}