help stockquote

Title

Get Time Series Stock Quotes from the net

Syntax

stockquote
<ticker symbol>, start_date(first day) end_date(last day)

Description

stockquote exploits the Python integration which, Stata introduced starting with version 16
(man python) and wraps itself around the Python module "yfinance" to query Yahoo's
Finance API for ticker symbol historical values. The "yfinance" module can do much more of course
and stockquote translates only part of its functionality for Stata speakers.

You need Python 3.7 (go with Anaconda) and, besides Stata 16 or more, you need to
have configured your Stata to use the right Python on your system. To install
"yfinance" run the command pip install yfinance at the command line.

Examples

The command below

. stockquote ^GDAXI, start_date(2010-01-01) end_date(2010-01-30)

will "use" the daily historical values of the DAX index from January 1 2010 to January 30 2010, whereas

. stockquote AAPL, start_date(2010-01-01) end_date(2010-01-30)

will do the same for the Apple stock.

Author

Nikos Askitas, IZA - Institute of Labor Economics, Bonn, Germany.
Email: nikos@iza.org, Twitter: @askitas
Web: askitas.com