I am currently looking for a way to import financial data into python directly. I was looking at a few alternatives finding the yfinance
API to be the best so far. I created a notebook that explains it and how it works in a git repositiry . However, I found that one cannot get the financial data as proposed in the documentation but just the market data. Can someone direct me to a better source to get financial data directly into Python for free?
I am particularly interested in looking at equities and would like to get the data into python directly using an API rather than downloading data then importing it into Python.
Sorry if this is a silly question, I have found a lot of API's that seem not to work on my computer so it would be great to get a referral from someone whom uses a particular method often.
I've used pandas_datareader to get daily stock info and its pretty straight forward.
here's how to install:
!pip install pandas_datareader
here's some simple code to pull high, low, open, close, volume, and adj close for the SPY
import pandas as pd
import numpy as np
import pandas_datareader as pdr
import datetime as dt
start = dt.datetime(1993, 1, 29)
end = dt.datetime(2020, 4, 15)
spy = pdr.get_data_yahoo('SPY', start=start, end=end)
spy.head()
this is a pretty simple way to pull daily information, but I've attached a link to an article for a couple of different API's if you're looking for something a bit more intricate.
https://towardsdatascience.com/best-5-free-stock-market-apis-in-2019-ad91dddec984