Skip to content

Commit

Permalink
Merge pull request #135 from JECSand/development
Browse files Browse the repository at this point in the history
Fixes for Yahoo Encryption & Missing Data, Plus Adding ESG
  • Loading branch information
JECSand authored Feb 14, 2023
2 parents 084a09c + 79f72c4 commit 4be2b62
Show file tree
Hide file tree
Showing 8 changed files with 2,612 additions and 292 deletions.
5 changes: 4 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@
1.9 01/14/2023 -- Fixed new data encryption issue & hardened.
1.10 01/25/2023 -- Fixed new decryption issue.
1.11 01/26/2023 -- Added a dynamic fix for the decryption issue.
1.12 01/27/2023 -- Fixed get profile function for #127 and added additional unit test
1.12 01/27/2023 -- Fixed get profile function for #127 and added additional unit test.
1.13 02/14/2023 -- Implemented fixes for #132 and #128 by refactoring package to use Yahoo API instead of scraping.
1.13 02/14/2023 -- Added method to retrieve ESG data as requested in #48.
1.13 02/14/2023 -- Added additional unit tests.
22 changes: 11 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ A python module that returns stock, cryptocurrency, forex, mutual fund, commodit
.. image:: https://github.com/JECSand/yahoofinancials/actions/workflows/test.yml/badge.svg?branch=master
:target: https://github.com/JECSand/yahoofinancials/actions/workflows/test.yml

Current Version: v1.12
.. image:: https://static.pepy.tech/badge/yahoofinancials
:target: https://pepy.tech/project/yahoofinancials

Version Released: 01/27/2023
Current Version: v1.13

Version Released: 02/14/2023

Report any bugs by opening an issue here: https://github.com/JECSand/yahoofinancials/issues

Expand All @@ -32,9 +35,8 @@ A powerful financial data module used for pulling both fundamental and technical
balance_sheet_data_qt = yahoo_financials.get_financial_stmts('quarterly', 'balance')
print(balance_sheet_data_qt)
- New methods in Version 1.9:
- get_stock_profile_data()
- get_financial_data()
- New methods in Version 1.13:
- get_esg_score_data()


Installation
Expand Down Expand Up @@ -95,8 +97,7 @@ Featured Methods
- reformat optional value defaulted to true. Enter False for unprocessed raw data from Yahoo Finance.
2. get_stock_price_data(reformat=True)

- reformat optional value defaulted to true. Enter False for unprocessed raw data from Yahoo Finance.
3. get_stock_earnings_data(reformat=True)
3. get_stock_earnings_data()

- reformat optional value defaulted to true. Enter False for unprocessed raw data from Yahoo Finance.
4. get_summary_data(reformat=True)
Expand All @@ -116,12 +117,11 @@ Featured Methods

- price_type can also be set to 'average' to calculate the shares outstanding with the daily average price.

Methods Added in v1.5
^^^^^^^^^^^^^^^^^^^^^^^
- get_daily_dividend_data(start_date, end_date)

Additional Module Methods
^^^^^^^^^^^^^^^^^^^^^^^^^
- get_daily_dividend_data(start_date, end_date)
- get_stock_profile_data()
- get_financial_data()
- get_interest_expense()
- get_operating_income()
- get_total_operating_expense()
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@

setup(
name='yahoofinancials',
version='1.12',
version='1.13',
description='A powerful financial data module used for pulling both fundamental and technical data from Yahoo Finance',
long_description=long_description,
url='https://github.com/JECSand/yahoofinancials',
download_url='https://github.com/JECSand/yahoofinancials/archive/1.12.tar.gz',
download_url='https://github.com/JECSand/yahoofinancials/archive/1.13.tar.gz',
author='Connor Sanders',
author_email='[email protected]',
license='MIT',
keywords=['finance data', 'stocks', 'commodities', 'cryptocurrencies', 'currencies', 'forex', 'yahoo finance'],
packages=['yahoofinancials'],
install_requires=[
"beautifulsoup4>=4.11.1",
"pytz",
"cryptography>=3.3.2",
# "pycryptodome>=3.6.6"
"requests>=2.26",
],
classifiers=[
Expand Down
41 changes: 37 additions & 4 deletions test/test_yahoofinancials.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# YahooFinancials Unit Tests v1.10
# Version Released: 01/14/2023
# YahooFinancials Unit Tests v1.13
# Version Released: 02/14/2023
# Author: Connor Sanders
# Tested on Python 3.6, 3.7, 3.8, 3.9, 3.10, and 3.11
# Copyright (c) 2023 Connor Sanders
Expand Down Expand Up @@ -95,19 +95,52 @@ def test_yf_dividend_price(self):

# Extra Module Methods Test
def test_yf_module_methods(self):
# Stocks
# Stock Current Price
if isinstance(self.test_yf_stock_single.get_current_price(), float):
self.assertEqual(True, True)
else:
self.assertEqual(False, True)
if isinstance(self.test_yf_stock_single.get_net_income(), int):
# Stock Net Income
if isinstance(self.test_yf_stock_single.get_net_income(), float):
self.assertEqual(True, True)
else:
self.assertEqual(False, True)
# Stock Profile Data
if self.test_yf_stock_single.get_stock_profile_data().get("C").get("sector") == "Financial Services":
self.assertEqual(True, True)
else:
self.assertEqual(False, True)

# Stock Financial Data
if self.test_yf_stock_single.get_financial_data().get("C").get("financialCurrency") == "USD":
self.assertEqual(True, True)
else:
self.assertEqual(False, True)

# Stock Summary Data
if self.test_yf_stock_single.get_summary_data().get("C").get("currency") == "USD":
self.assertEqual(True, True)
else:
self.assertEqual(False, True)

# Stock Price Data
if self.test_yf_stock_single.get_stock_price_data().get("C").get("exchangeName") == "NYSE":
self.assertEqual(True, True)
else:
self.assertEqual(False, True)

# Stock Key Statistics
if isinstance(self.test_yf_stock_single.get_key_statistics_data().get("C").get("forwardPE"), float):
self.assertEqual(True, True)
else:
self.assertEqual(False, True)

# Stock ESG SCORES
if self.test_yf_stock_single.get_esg_score_data().get("C").get("peerGroup") == "Banks":
self.assertEqual(True, True)
else:
self.assertEqual(False, True)

# Treasuries
if isinstance(self.test_yf_treasuries_single.get_current_price(), float):
self.assertEqual(True, True)
Expand Down
Loading

0 comments on commit 4be2b62

Please sign in to comment.