diff --git a/.gitignore b/.gitignore index 7b3e374..3569283 100644 --- a/.gitignore +++ b/.gitignore @@ -224,3 +224,4 @@ $RECYCLE.BIN/ # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) .vscode/ +archive/ diff --git a/docs/documentation.md b/docs/documentation.md index 70e4f6e..9d5f43f 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -3,9 +3,9 @@ [![Upload Python Package](https://github.com/Visionary-Code-Works/stock-analysis-program/actions/workflows/python_publish.yml/badge.svg)](https://github.com/Visionary-Code-Works/stock-analysis-program/actions/workflows/python_publish.yml) - [Home](../README.md) -- [Workflow](./Workflow.md) -- [Plotter](./Plotter.md) - [Fetcher](./Fetcher.md) +- [Plotter](./Plotter.md) +- [Workflow](./Workflow.md) ## Overview diff --git a/src/stock_analysis_program/main.py b/main.py similarity index 93% rename from src/stock_analysis_program/main.py rename to main.py index 1386203..42eb6d4 100644 --- a/src/stock_analysis_program/main.py +++ b/main.py @@ -9,7 +9,7 @@ plotting capabilities for stocks and financial indices. """ -from .__init__ import ( +from src.stock_analysis_program import ( StockDataFetcher, StockSummaryFetcher, FinancialMetricsFetcher, @@ -219,18 +219,20 @@ def main(): visualization. The script runs in a loop until the user chooses to exit. """ while True: - print("\nStock Data Analysis Menu") - print("1. Use Stock Data Fetcher") - print("2. Use Stock Summary Fetcher") - print("3. Use Financial Metrics Fetcher") - print("4. Use Revenue Growth Fetcher") - print("5. Use Stock Price Plotter") - print("6. Use Financial Metrics Plotter") - print("7. Use Revenue Growth Plotter") - print("8. Use Stock Volatility Plotter") - print("9. Use Stock Exchange Performance Plotter") - print("10. Use Current Prices Ticker Display") - print("0. Exit") + print( + "\nStock Data Analysis Menu\n", + "1. Use Stock Data Fetcher\n", + "2. Use Stock Summary Fetcher\n", + "3. Use Financial Metrics Fetcher\n", + "4. Use Revenue Growth Fetcher\n", + "5. Use Stock Price Plotter\n", + "6. Use Financial Metrics Plotter\n", + "7. Use Revenue Growth Plotter\n", + "8. Use Stock Volatility Plotter\n", + "9. Use Stock Exchange Performance Plotter\n", + "10. Use Current Prices Ticker Display\n", + "0. Exit\n" + ) choice = input("Enter your choice: ") diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/data/finance_apis.csv b/src/data/finance_apis.csv index 2f84891..71e9bb4 100644 --- a/src/data/finance_apis.csv +++ b/src/data/finance_apis.csv @@ -1,9 +1,9 @@ -API Name,Website,Unique Feature,Pricing -Alpha Vantage,https://www.alphavantage.co,Wide range of data services; technical indicators,Free/Paid -IEX Cloud,https://iexcloud.io,Wide array of financial data; tiered pricing model with a free tier,Free/Paid -Quandl,https://www.quandl.com,"Financial, economic, and alternative data; free datasets available for academic use",Free/Paid -Financial Modeling Prep,https://financialmodelingprep.com,Broad set of financial data APIs; includes stock market data and financial statements,Free/Paid -World Trading Data,https://www.worldtradingdata.com,Real-time and historical stock data; free tier available,Free/Paid -MarketStack,https://marketstack.com,REST API interface to obtain stock market data from around the world; free tier with limited access,Free/Paid -Finnhub,https://finnhub.io,"Free APIs for stock data, forex, and crypto; both real-time and historical data",Free/Paid -Twelve Data,https://twelvedata.com,"Financial data including real-time and historical stock data, forex, and cryptocurrencies; free plan with limited access",Free/Paid +API Name, Website, Unique Feature, Pricing +Alpha Vantage, https://www.alphavantage.co, Wide range of data services; technical indicators, Free/Paid +Financial Modeling Prep, https://financialmodelingprep.com, Broad set of financial data APIs; includes stock market data and financial statements, Free +Finnhub, https://finnhub.io, "Free APIs for stock data, forex, and crypto; both real-time and historical data", Free/Paid +IEX Cloud, https://iexcloud.io, Wide array of financial data; tiered pricing model with a free tier, Free/Paid +MarketStack, https://marketstack.com, REST API interface to obtain stock market data from around the world; free tier with limited access, Free/Paid +Quandl, https://www.quandl.com, "Financial, economic, and alternative data; free datasets available for academic use", Free/Paid +Twelve Data, https://twelvedata.com, "Financial data including real-time and historical stock data, forex, and cryptocurrencies; free plan with limited access", Free/Paid +World Trading Data, https://www.worldtradingdata.com, Real-time and historical stock data; free tier available, Free/Paid \ No newline at end of file diff --git a/src/stock_analysis_program/fetcher/revenue_growth_fetcher.py b/src/stock_analysis_program/fetcher/revenue_growth_fetcher.py index bf3ffcf..64ee77c 100644 --- a/src/stock_analysis_program/fetcher/revenue_growth_fetcher.py +++ b/src/stock_analysis_program/fetcher/revenue_growth_fetcher.py @@ -12,6 +12,7 @@ import yfinance as yf + class RevenueGrowthFetcher: """ Fetches year-over-year revenue growth for a list of stock tickers. @@ -43,10 +44,14 @@ def fetch_revenue_growth(self): for ticker in self.tickers: company = yf.Ticker(ticker) income_statement = company.financials - if 'Total Revenue' in income_statement.index: - revenue = income_statement.loc['Total Revenue'] - revenue_growth = revenue.pct_change(periods=-1) # Negative periods for year-over-year growth - growth_data[ticker] = revenue_growth.dropna().iloc[0] # Most recent growth value + if "Total Revenue" in income_statement.index: + revenue = income_statement.loc["Total Revenue"] + revenue_growth = revenue.pct_change( + periods=-1 + ) # Negative periods for year-over-year growth + growth_data[ticker] = revenue_growth.dropna().iloc[ + 0 + ] # Most recent growth value else: growth_data[ticker] = None return growth_data