

Often times we do not want the entire stock exchange history for a ticker symbol, but rather a date range. It is a highly customized wrapper, centered on the pandas.
#Yfinance documentation code#
The following is the code for fancy_plot(), which I use for many of my visualizations. Plotting the last 60+ years of stock fluctuations for GE reveals some soaring prices and some unfortunate declines as well. The following is the code for head_tail_vert() and head_tail_horz(), which I use with dataframes extensively to present more easily digestible, labeled data. So with yf.download() and a ticker symbol alone, it is possible to get a great deal of data. By default, if we only pass the ticker name, we receive the data for every trading day in the history of the company, which as you can see below for GE, dates back to January 2, 1962. To dive right in, after importing yfinance as yf, we will create a ticker variable for "GE" and pass it to yf.download(). There is no API key needed, and the yfinance module can return an incredible wealth of data with just one line of code. One of the most beneficial aspects of Yahoo Finance is how quick and easy it is to access data. Special thanks to Alexander Hagmann for his thorough instruction. To view the helpers.py file that I use in this project, please click here for GitHub.Other Links: Yahoo Finance | yfinance module.You can also look over helpers.py, which contains many helper functions that I use extensively throughout this project to streamline the delivery of data and create a more visually appealing experience.
#Yfinance documentation pdf#
For the full code included here, you can view the Jupyter, HTML, and PDF versions.

In this article, I will walk through the basic to the advanced and give an overview of the most powerful functionality of this very useful API. And with the convenient and fairly well-maintained yfinance module available for Python, few sources are easier to work with than Yahoo Finance. There is a wealth of information available through the API, including extensive company data, covering not only traded companies but also currency exchange, cryptocurrency, mutual funds, and treasury yields. For data science, Yahoo Finance is an ideal resource for quick, up-to-the-minute financial data, and it is not just for stocks.
