StockstatsUtils
This class provides utility functions for retrieving stock statistics. It allows fetching quantitative indicators based on stock data, either from online sources or offline files. The get_stock_stats method enables users to specify a ticker symbol, desired indicator, date, and data source configuration to retrieve a specific stock statistic.
Attributes
-
symbol: string
- ticker symbol for the company
-
indicator: string
- quantitative indicators based off of the stock data for the company
-
curr_date: string
- curr date for retrieving stock price data, YYYY-mm-dd
-
data_dir: string
- directory where the stock data is stored.
-
data_file: string
- path to the stock data file, if online is False, this is not used
-
online: bool = False
- whether to use online tools to fetch data or offline tools. If True, will use online tools.
Methods
def get_stock_stats(symbol: string, indicator: string, curr_date: string, data_dir: string, data_file: string, online: boolean = False) - > string
-
Retrieves quantitative indicators for a given stock symbol on a specific date. It can fetch data either online or offline from a specified directory or file. The function calculates and returns the value of the specified indicator for the given date, or a message if the date is not a trading day.
-
Parameters
- symbol: string
- ticker symbol for the company
- indicator: string
- quantitative indicators based off of the stock data for the company
- curr_date: string
- curr date for retrieving stock price data, YYYY-mm-dd
- data_dir: string
- directory where the stock data is stored.
- data_file: string
- path to the stock data file, if online is False, this is not used
- online: boolean
- whether to use online tools to fetch data or offline tools. If True, will use online tools.
- symbol: string
-
Return Value: string
- The value of the specified indicator for the given date, or 'N/A: Not a trading day (weekend or holiday)' if the date is not a trading day.