Free stock api for trading and research

finnhub stock api

Financial data nowadays, is surprisingly hard to get. Thanks to the new kid in the block Finnhub, we now have access to a free stock api with super high quality data. You can build trading strategy using their free data and backtest it in live market for free. In this example, we will try to pull the price of Apple and calculate a simple moving average.

You can get your Free API key first to access 60 calls/minute. In this tutorial I will use the API without a API key, which will limit me to 2 calls per mintue. Here is an example:

Get 2000 Daily candles for AAPL

import requests
import json
import pandas as pd
r = requests.get('')
j = json.loads(r.text)
closes = j['c'].
N = 20

To learn more about Finnhub stock API , read the docs here
Featured as the best option on Medium stock market API guide