A simple module for retreiving stock data
stockquotes is a simple Python module for collecting stock quotes and historical data from Yahoo! Finance. It's perfect for developers who can't afford the (often steep) prices charged by many stock data APIs.
- Python 3.6+
- Beautiful Soup 4
pip3 install stockquotes
First, import the
To get a stock quote, instantiate a
stockquotes.Stock object. The only parameter is the ticker symbol to look up.
kroger = stockquotes.Stock('KR')
To get the current price of a share, get the
krogerPrice = kroger.currentPrice
To get the day gain in dollars, get the
krogerGainDollars = kroger.increaseDollars
The same value as a percent is available in the
increasePercent property. To indicate losses, these values are negative.
The historical data for a stock can be accessed through the
historical property. This is an array of
dicts, with the first item representing the most recent quote. The
date property is a
datetime object representing the date the quote is from.
open is the opening price for that day.
low are the high and low prices, respectively, for that day.
adjClose are the closing price. The difference is that
adjClose is adjusted for splits and dividends, whereas
close is adjusted only for splits.
volume is the stock's volume for that day.
stockquotes.StockDoesNotExistError is raised when the stock does not exist.
stockquotes.NetworkError is raised when a connection to Yahoo! Finance cannot be established.
Copyright (c) 2019 ScoopGracie. All rights reversed. This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to https://unlicense.org/
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size stockquotes-1.0.5.tar.gz (3.6 kB)||File type Source||Python version None||Upload date||Hashes View|
|Filename, size stockquotes-1.0.5-py3-none-any.whl (5.4 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
Hashes for stockquotes-1.0.5-py3-none-any.whl