Skip to content

A python class to extract current and historical data from famous Yahoo Finance API

License

Notifications You must be signed in to change notification settings

rubenafo/YahooFetcher

Repository files navigation

YahooFetcher

A simple Python class to retrieve stock data from famous Yahoo Finance API. Last update fixes the new Yahoo Finance API workaround that had to be implemented after 17th May when Yahoo decided to change the whole structure.

Features:

  • eod quotes, dividends and splits information
  • Index components (up to 30 underlying instruments)
  • NASDAQ and NYSE exchange components

Disclaimer: this module provides access to a non-official Yahoo API. In fact they do not provide any type of support/documentation of it and all existent information has been obtained through reverse engineering.
Use at your own risk and do not abuse Yahoo resources.

Example

Run sampleMSFT.py to fetch IBM quote price for last year:

import YahooFetcher

y = YahooFetcher.YahooFetcher()
print (y.getHistAsJson ('IBM','20160101','20161231'))

The output will look like

[{'c': 175.800003, 'v': 4094800, 'ticker': 'IBM', 'h': 177.070007, 'adjc': 175.800003, 'l': 174.580002, 'date': '2017-01-30', 'o': 176.979996},
...]

It also provides a method to extract the underlying components of an index (up to 30 components):

print YahooQuery().getComponents("DJI")

['JNJ', 'CAT', 'MCD', 'V', 'MSFT', 'PG', 'PFE', 'UTX', 'MMM', 'AXP', 'JPM', 'VZ', 'INTC', 'BA', 'GE', 'HD', 'GS', 'DIS', 'IBM', 'AAPL', 'UNH', 'XOM', 'WMT', 'KO', 'TRV', 'DD', 'NKE', 'MRK', 'CSCO', 'CVX']

About

A python class to extract current and historical data from famous Yahoo Finance API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages