|
| 1 | +# Fetchers |
| 2 | + |
| 3 | +[Home](../README.md) |
| 4 | +[Workflow](./Workflow.md) |
| 5 | +[Plotter](./Plotter.md) |
| 6 | +[Documentation](./documentation.md) |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +The `fetcher` package is designed for financial data retrieval and analysis. It includes classes for fetching financial metrics, revenue growth, stock data, and stock summaries from Yahoo Finance using the `yfinance` library. This package is suitable for investors, financial analysts, traders, and anyone interested in performing detailed stock market research and analysis. |
| 11 | + |
| 12 | +### Classes |
| 13 | + |
| 14 | +- `FinancialMetricsFetcher` |
| 15 | +- `RevenueGrowthFetcher` |
| 16 | +- `StockDataFetcher` |
| 17 | +- `StockSummaryFetcher` |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +| Class / Initialization | Description | Methods | |
| 22 | +| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 23 | +| FinancialMetricsFetcher </br> `FinancialMetricsFetcher(tickers)` | Retrieves important financial metrics for a list of stock tickers, including:<br> market capitalization, P/E ratio, forward P/E, price to book ratio, and profit margins.<br> Ideal for financial analysis and comparisons across different stocks. | **`fetch_financial_metrics`**: Fetches and compiles financial metrics for each ticker in the list.<br> **Returns**<br> - `pandas.DataFrame`: A DataFrame containing the financial metrics for each ticker. | |
| 24 | +| RevenueGrowthFetcher </br> `RevenueGrowthFetcher(tickers)` | Fetches and calculates the year-over-year revenue growth for a list of stock tickers.<br> Utilizes historical financial data to assess company performance over time. | **`fetch_revenue_growth`**: Calculates the most recent year-over-year revenue growth for each ticker.<br> **Returns**<br> - `dict`: A dictionary with tickers as keys and their respective year-over-year revenue growth percentages as values. | |
| 25 | +| StockDataFetcher </br> `StockDataFetcher(ticker)` | Fetches various types of stock data, including: historical data, moving averages,<br> average trading volume, and key financial metrics. | **`fetch_historical_data`**: Retrieves historical stock data for the specified period.<br> **Parameters**<br> - `period` (str, optional): The time period for which to fetch the data. Defaults to '1y'.<br> **Returns**<br> - `pandas.DataFrame`: Historical stock data.<br><br>**`calculate_moving_averages`**: Calculates moving averages for given window sizes.<br><br>**`get_average_volume`**: Calculates the average trading volume.<br><br>**`get_financial_metrics`**: Fetches and returns key financial metrics. | |
| 26 | +| StockSummaryFetcher </br> `StockSummaryFetcher(tickers)` | Fetches and provides summary information for a list of stock tickers, including:<br> company name, sector, industry, and key financial metrics. | **`fetch_summary`**: Fetches summary information for a given stock ticker.<br> **Parameters**<br> - `ticker` (str): The stock ticker.<br> **Returns**<br> - `dict`: Summary information of the stock.<br><br>**`get_summaries`**: Retrieves stock summaries for all tickers specified during initialization.<br> **Returns**<br> - `list of dict`: Summaries for each stock ticker. | |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## FinancialMetricsFetcher |
| 31 | + |
| 32 | +### Description |
| 33 | + |
| 34 | +Retrieves important financial metrics for a list of stock tickers, including market capitalization, P/E ratio, forward P/E, price to book ratio, and profit margins. Ideal for financial analysis and comparisons across different stocks. |
| 35 | + |
| 36 | +### Initialization |
| 37 | + |
| 38 | +```python |
| 39 | +FinancialMetricsFetcher(tickers) |
| 40 | +``` |
| 41 | + |
| 42 | +#### Parameters |
| 43 | + |
| 44 | +- `tickers` (list of str): A list of stock ticker symbols (e.g., `['AAPL', 'MSFT']`) for which financial metrics are to be fetched. |
| 45 | + |
| 46 | +### Methods |
| 47 | + |
| 48 | +#### fetch_financial_metrics |
| 49 | + |
| 50 | +Fetches and compiles financial metrics for each ticker in the list. |
| 51 | + |
| 52 | +##### Returns |
| 53 | + |
| 54 | +- `pandas.DataFrame`: A DataFrame containing the financial metrics for each ticker. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## RevenueGrowthFetcher |
| 59 | + |
| 60 | +### Description |
| 61 | + |
| 62 | +Fetches and calculates the year-over-year revenue growth for a list of stock tickers. Utilizes historical financial data to assess company performance over time. |
| 63 | + |
| 64 | +### Initialization |
| 65 | + |
| 66 | +```python |
| 67 | +RevenueGrowthFetcher(tickers) |
| 68 | +``` |
| 69 | + |
| 70 | +#### Parameters |
| 71 | + |
| 72 | +- `tickers` (list of str): Stock tickers to fetch the revenue growth for. |
| 73 | + |
| 74 | +### Methods |
| 75 | + |
| 76 | +`fetch_revenue_growth`: Calculates the most recent year-over-year revenue growth for each ticker. |
| 77 | + |
| 78 | +Returns |
| 79 | + |
| 80 | +- `dict`: A dictionary with tickers as keys and their respective year-over-year revenue growth percentages as values. |
| 81 | + |
| 82 | +--- |
| 83 | + |
| 84 | +## StockDataFetcher |
| 85 | + |
| 86 | +### Description |
| 87 | + |
| 88 | +Fetches various types of stock data, including historical data, moving averages, average trading volume, and key financial metrics. |
| 89 | + |
| 90 | +### Initialization |
| 91 | + |
| 92 | +```python |
| 93 | +StockDataFetcher(ticker) |
| 94 | +``` |
| 95 | + |
| 96 | +#### Parameters |
| 97 | + |
| 98 | +- `ticker` (str): The stock ticker symbol for which the data is to be fetched. |
| 99 | + |
| 100 | +### Methods |
| 101 | + |
| 102 | +#### fetch_historical_data |
| 103 | + |
| 104 | +Retrieves historical stock data for the specified period. |
| 105 | + |
| 106 | +##### Parameters |
| 107 | + |
| 108 | +- `period` (str, optional): The time period for which to fetch the data. Defaults to '1y'. |
| 109 | + |
| 110 | +##### Returns |
| 111 | + |
| 112 | +- `pandas.DataFrame`: Historical stock data. |
| 113 | + |
| 114 | +#### calculate_moving_averages |
| 115 | + |
| 116 | +Calculates moving averages for given window sizes. |
| 117 | + |
| 118 | +##### Parameters |
| 119 | + |
| 120 | +- `data` (pandas.DataFrame): The historical stock data. |
| 121 | +- `window_sizes` (list of int, optional): Window sizes for calculating moving averages. Defaults to `[20, 50, 200]`. |
| 122 | + |
| 123 | +##### Returns |
| 124 | + |
| 125 | +- `dict`: Moving averages for each window size. |
| 126 | + |
| 127 | +#### get_average_volume |
| 128 | + |
| 129 | +Calculates the average trading volume. |
| 130 | + |
| 131 | +##### Parameters |
| 132 | + |
| 133 | +- `data` (pandas.DataFrame): The historical stock data. |
| 134 | + |
| 135 | +##### Returns |
| 136 | + |
| 137 | +- `float`: Average trading volume. |
| 138 | + |
| 139 | +#### get_financial_metrics |
| 140 | + |
| 141 | +Fetches and returns key financial metrics for the stock. |
| 142 | + |
| 143 | +##### Returns |
| 144 | + |
| 145 | +- `dict`: Key financial metrics. |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | +## StockSummaryFetcher |
| 150 | + |
| 151 | +### Description |
| 152 | + |
| 153 | +Fetches and provides summary information for a list of stock tickers, including company name, sector, industry, and key financial metrics. |
| 154 | + |
| 155 | +### Initialization |
| 156 | + |
| 157 | +```python |
| 158 | +StockSummaryFetcher(tickers) |
| 159 | +``` |
| 160 | + |
| 161 | +#### Parameters |
| 162 | + |
| 163 | +- `tickers` (str or list of str): The stock ticker(s) for which the summary information is to be fetched. |
| 164 | + |
| 165 | +### Methods |
| 166 | + |
| 167 | +#### fetch_summary |
| 168 | + |
| 169 | +Fetches summary information for a given stock ticker. |
| 170 | + |
| 171 | +##### Parameters |
| 172 | + |
| 173 | +- `ticker` (str): The stock ticker. |
| 174 | + |
| 175 | +##### Returns |
| 176 | + |
| 177 | +- `dict`: Summary information of the stock. |
| 178 | + |
| 179 | +#### get_summaries |
| 180 | + |
| 181 | +Retrieves stock summaries for all tickers specified during initialization. |
| 182 | + |
| 183 | +##### Returns |
| 184 | + |
| 185 | +- `list of dict`: Summaries for each stock ticker. |
0 commit comments