Skip to content

Instantly share code, notes, and snippets.

@alvarobartt
Created October 23, 2019 12:47
Show Gist options
  • Save alvarobartt/0c8c690c8bc5e0c8bb535bd3c178b7e8 to your computer and use it in GitHub Desktop.
Save alvarobartt/0c8c690c8bc5e0c8bb535bd3c178b7e8 to your computer and use it in GitHub Desktop.
This is a sample on investpy usage when it comes to stock data retrieval, as current release is 0.9.7.
import investpy
print(investpy.__author__, investpy.__version__)
# Retrieve a `pandas.DataFrame` containing all the Stocks from United States
stocks = investpy.get_stocks(country='united states')
# Retrieve historical data from AAPL
df = investpy.get_stock_historical_data(stock='AAPL', # Stock symbol of the stock to retrieve data from
country='united states', # Country from where the introduced stock is from
from_date='01/01/2010', # Date since data is going to be retrieved formatted as dd/mm/yyyy
to_date='01/01/2019' # Date until data is going to be retrieved formatted as dd/mm/yyyy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment