Skip to main content

An API for Yahoo Finance that collects current and historical stock data

Project description

Information

A fast, easy API that retrieves stock data from Yahoo Finance. Data can be initialized by scraping data from yahoo finance or by reading from a json file saved by a previous session. Data collected includes current data as well as all historical data for a stock up to the past 50 years. Unlike other APIs that collect data from Yahoo Finance this API has built in easy to use functions to filter collected data. #Installation

Required Dependencies

Documentation

  • initializeStockData(symbol) - takes in a stock symbol and collects the needed data to be processed. If the symbol is invalid or the connection refused then None is returned

  • initializeStockDataFromJson - initializes the stock data from a previously generated json doc. Returns None if no json doc is available.

  • getStockPrice(Symbol) - takes in the stock symobol and gets the stock price. If no data is available or if the stock has not been initialized then None is returned

  • getStockPriceAfterHours(Symbol) - takes in the stock symobol and gets the stock price after hours. If no data is available or if the stock has not been initialized then None is returned

  • getChangeAtClose(Symbol) -takes in the stock symbol and returns the point change and percentage change in an array. If no data is available or if the stock has not been initialized then None is returned

  • getPointChangeAtClose(Symbol) - takes in the stock symbol and returns the point change at close. If no data is available or if the stock has not been initialized then None is returned

  • getPercentageChangeAtClose(Symbol) - takes in the stock symbol and returns the percentage change at close. If no data is available or if the stock has not been initialized then None is returned

  • getPointChangeAfterHours(Symbol) - takes in the stock symbol and returns the point change after hours. If no data is available or if the stock has not been initialized then None is returned

  • getPercentageChangeAfterHours(Symbol) - takes in the stock symbol and returns the percentage change after hours. If no data is available or if the stock has not been initialized then None is returned

  • getPreviousClose(Symbol) - takes in the stock symbol and returns the previous close price. If no data is available or if the stock has not been initialized then None is returned

  • getOpen(Symbol) - takes in the stock symbol and returns the open price. If no data is available or if the stock has not been initialized then None is returned

  • getDayRange(Symbol) - takes in the stock symbol and returns the day's high and low as an array. If no data is available or if the stock has not been initialized then None is returned

  • getDayLow(Symbol) - takes in the stock symbol and returns the day's low. If no data is available or if the stock has not been initialized then None is returned

  • getDayHigh(Symbol) - takes in the stock symbol and returns the day's high. If no data is available or if the stock has not been initialized then None is returned

  • get52WeekRange(Symbol) - takes in the stock symbol and returns the 52 week's high and low as an array. If no data is available or if the stock has not been initialized then None is returned

  • get52WeekLow(Symbol) - takes in the stock symbol and returns the 52 week's low. If no data is available or if the stock has not been initialized then None is returned

  • get52WeekHigh(Symbol) - takes in the stock symbol and returns the 52 week's high. If no data is available or if the stock has not been initialized then None is returned

  • getVolume(Symbol) - takes in the stock symbol and returns the volume. If no data is available or if the stock has not been initialized then None is returned

  • getAverageVolume(Symbol) - takes in the stock symbol and returns the average volume. If no data is available or if the stock has not been initialized then None is returned

  • getMarketCap(Symbol) - takes in the stock symbol and returns the market cap. If no data is available or if the stock has not been initialized then None is returned

  • getHistoricalDataAll(symbol) - takes in the stock symbol and returns all historical data in a dict with keys being "open", "low", "close", "high" holding the historical data in an array from most recent to least recent. If no data is available or if the stock has not been initialized then None is returned

  • getHistoricalDataRangeTradingDays(symbol, num1, num2) - takes in the stock symbol and a range of days and returns the historical data in a dict with keys being "open", "low", "close", "high" holding the historical data in an array from most recent to least recent. If no data is available or if the stock has not been initialized then None is returned

  • getHistoricalDataPastXTradingDays(symbol, num1) - takes in the stock symbol and the past number of days and returns the historical data in a dict with keys being "open", "low", "close", "high" holding the historical data in an array from most recent to least recent. If no data is available or if the stock has not been initialized then None is returned

  • getHistoricalDataPast5TradingDays(symbol) - takes in the stock symbol returns the historical data of the past five days in a dict with keys being "open", "low", "close", "high" holding the historical data in an array from most recent to least recent. If no data is available or if the stock has not been initialized then None is returned

  • getHistoricalDataPast30TradingDays(symbol) - takes in the stock symbol returns the historical data of the past thirty days in a dict with keys being "open", "low", "close", "high" holding the historical data in an array from most recent to least recent. If no data is available or if the stock has not been initialized then None is returned

  • getHistoricalDataRangeOfDates(symbol, date1, date2) - takes in the stock symbol and a range of dates in "YYYY-MM-DD" format and returns the historical data in a dict with keys being "open", "low", "close", "high" holding the historical data in an array from most recent to least recent. If no data is available or if the stock has not been initialized then None is returned

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stock-data-interface-1.0.8.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stock_data_interface-1.0.8-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file stock-data-interface-1.0.8.tar.gz.

File metadata

  • Download URL: stock-data-interface-1.0.8.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8

File hashes

Hashes for stock-data-interface-1.0.8.tar.gz
Algorithm Hash digest
SHA256 5b78b089909e077bc7b3ac45a5cc9cdf1e8ca67601b9297153f32f8e0d3a0d35
MD5 0b17bec531c071909d1bd58a6a08a106
BLAKE2b-256 d9d5e7b0924813e7a93013f1b5cf69fe8f93f128dae49a655e80f56e5e0775ef

See more details on using hashes here.

File details

Details for the file stock_data_interface-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: stock_data_interface-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8

File hashes

Hashes for stock_data_interface-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 dc4186f603f5cb7b757392b6cdf8dc622d58e5eaae25a2dd7ddee273257f4d79
MD5 8aad945826cfc39cc4fb26720be15daa
BLAKE2b-256 1436ead07c32bcc045854a2b9d6e4edb4185caa0d9a02bf67c5372c9429b45db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page