Skip to content
Open

Dev #17

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
4 changes: 2 additions & 2 deletions docs/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 15 additions & 13 deletions src/stock_analysis_program/main.py → main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
plotting capabilities for stocks and financial indices.
"""

from .__init__ import (
from src.stock_analysis_program import (
StockDataFetcher,
StockSummaryFetcher,
FinancialMetricsFetcher,
Expand Down Expand Up @@ -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: ")

Expand Down
Empty file added src/__init__.py
Empty file.
18 changes: 9 additions & 9 deletions src/data/finance_apis.csv
Original file line number Diff line number Diff line change
@@ -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
13 changes: 9 additions & 4 deletions src/stock_analysis_program/fetcher/revenue_growth_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import yfinance as yf


class RevenueGrowthFetcher:
"""
Fetches year-over-year revenue growth for a list of stock tickers.
Expand Down Expand Up @@ -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