Skip to content

Instantly share code, notes, and snippets.

@njsoly
Forked from andymarvel/stock_market_api.py
Last active July 20, 2020 23:57
Show Gist options
  • Select an option

  • Save njsoly/6c5361b5be032c16c03d9d63b719ffbf to your computer and use it in GitHub Desktop.

Select an option

Save njsoly/6c5361b5be032c16c03d9d63b719ffbf to your computer and use it in GitHub Desktop.
import requests
## you will need to add an API key parameter if you call these more than a few times ##
#OHLC data
r = requests.get('https://finnhub.io/api/v1/stock/candle?symbol=AAPL&resolution=1&from=1572651390&to=1572910590')
print(r.json())
#Tick data - premium accounts only
r = requests.get('https://finnhub.io/api/v1/stock/tick?symbol=AAPL&date=2020-03-25')
print(r.json())
# Quote data
r = requests.get('https://finnhub.io/api/v1/quote?symbol=AAPL')
print(r.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment