Skip to content

Commit

Permalink
added daily dividend method as requested in Issue #20
Browse files Browse the repository at this point in the history
  • Loading branch information
JECSand committed Jan 27, 2019
1 parent 0e1e1b0 commit 76fe4ab
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 55 deletions.
3 changes: 2 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@
1.4 01/13/2019 -- Python3.7 support added.
1.4 01/13/2019 -- Added patch for reported bug described in Issue #15.
1.4 01/13/2019 -- Added method for get_stock_earnings_data().
1.5 01/27/2019 -- Added get_daily_dividend_data() method as request in Issue #20.
1.5 01/27/2019 -- Added get_daily_dividend_data() method as request in Issue #20.
1.5 01/27/2019 -- Added test_yf_dividend_price() unit testing method.
155 changes: 109 additions & 46 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ A python module that returns stock, cryptocurrency, forex, mutual fund, commodit
.. image:: https://travis-ci.org/JECSand/yahoofinancials.svg?branch=master
:target: https://travis-ci.org/JECSand/yahoofinancials

Current Version: v1.4
Current Version: v1.5

Version Released: 01/13/2019
Version Released: 01/27/2019

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

Expand All @@ -20,7 +20,7 @@ A powerful financial data module used for pulling both fundamental and technical
- As of Version 0.10, Yahoo Financials now returns historical pricing data for commodity futures, cryptocurrencies, ETFs, mutual funds, U.S. Treasuries, currencies, indexes, and stocks.

Installation
------------
-------------
- yahoofinancials runs on Python 2.7, 3.3, 3.4, 3.5, 3.6, and 3.7.
- The package depends on beautifulsoup4 and pytz to work.

Expand Down Expand Up @@ -98,53 +98,54 @@ Featured Methods

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

Methods Added in V1.4
Methods Added in V1.5
^^^^^^^^^^^^^^^^^^^^^^^
- get_key_statistics_data():
- get_daily_dividend_data(start_date, end_date)

Additional Module Methods
^^^^^^^^^^^^^^^^^^^^^^^^^
- get_interest_expense():
- get_operating_income():
- get_total_operating_expense():
- get_total_revenue():
- get_cost_of_revenue():
- get_income_before_tax():
- get_income_tax_expense():
- get_gross_profit():
- get_net_income_from_continuing_ops():
- get_research_and_development():
- get_current_price():
- get_current_change():
- get_current_percent_change():
- get_current_volume():
- get_prev_close_price():
- get_open_price():
- get_ten_day_avg_daily_volume():
- get_three_month_avg_daily_volume():
- get_stock_exchange():
- get_market_cap():
- get_daily_low():
- get_daily_high():
- get_currency():
- get_yearly_high():
- get_yearly_low():
- get_dividend_yield():
- get_annual_avg_div_yield():
- get_five_yr_avg_div_yield():
- get_dividend_rate():
- get_annual_avg_div_rate():
- get_50day_moving_avg():
- get_200day_moving_avg():
- get_beta():
- get_payout_ratio():
- get_pe_ratio():
- get_price_to_sales():
- get_exdividend_date():
- get_book_value():
- get_ebit():
- get_net_income():
- get_earnings_per_share():
- get_interest_expense()
- get_operating_income()
- get_total_operating_expense()
- get_total_revenue()
- get_cost_of_revenue()
- get_income_before_tax()
- get_income_tax_expense()
- get_gross_profit()
- get_net_income_from_continuing_ops()
- get_research_and_development()
- get_current_price()
- get_current_change()
- get_current_percent_change()
- get_current_volume()
- get_prev_close_price()
- get_open_price()
- get_ten_day_avg_daily_volume()
- get_three_month_avg_daily_volume()
- get_stock_exchange()
- get_market_cap()
- get_daily_low()
- get_daily_high()
- get_currency()
- get_yearly_high()
- get_yearly_low()
- get_dividend_yield()
- get_annual_avg_div_yield()
- get_five_yr_avg_div_yield()
- get_dividend_rate()
- get_annual_avg_div_rate()
- get_50day_moving_avg()
- get_200day_moving_avg()
- get_beta()
- get_payout_ratio()
- get_pe_ratio()
- get_price_to_sales()
- get_exdividend_date()
- get_book_value()
- get_ebit()
- get_net_income()
- get_earnings_per_share()
- get_key_statistics_data()

Usage Examples
--------------
Expand Down Expand Up @@ -620,6 +621,7 @@ Examples of Returned JSON Data
"ytdReturn": null
}
}
11. Apple Key Statistics Data:


Expand Down Expand Up @@ -686,3 +688,64 @@ Examples of Returned JSON Data
"fiveYearAverageReturn": null
}
}
12. Apple and Wells Fargo Daily Dividend Data:


.. code-block:: python
start_date = '1987-09-15'
end_date = '1988-09-15'
yahoo_financials = YahooFinancials(['AAPL', 'WFC'])
print(yahoo_financials.get_daily_dividend_data(start_date, end_date))
.. code-block:: javascript
{
"AAPL": [
{
"date": 564157800,
"formatted_date": "1987-11-17",
"amount": 0.08
},
{
"date": 571674600,
"formatted_date": "1988-02-12",
"amount": 0.08
},
{
"date": 579792600,
"formatted_date": "1988-05-16",
"amount": 0.08
},
{
"date": 587655000,
"formatted_date": "1988-08-15",
"amount": 0.08
}
],
"WFC": [
{
"date": 562861800,
"formatted_date": "1987-11-02",
"amount": 0.3008
},
{
"date": 570724200,
"formatted_date": "1988-02-01",
"amount": 0.3008
},
{
"date": 578583000,
"formatted_date": "1988-05-02",
"amount": 0.3344
},
{
"date": 586445400,
"formatted_date": "1988-08-01",
"amount": 0.3344
}
]
}
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

setup(
name='yahoofinancials',
version='1.4',
version='1.5',
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.4.tar.gz',
download_url='https://github.com/JECSand/yahoofinancials/archive/1.5.tar.gz',
author='Connor Sanders',
author_email='[email protected]',
license='MIT',
Expand Down
5 changes: 2 additions & 3 deletions test/test_yahoofinancials.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# YahooFinancials Unit Tests v1.4
# Version Released: 01/13/2019
# YahooFinancials Unit Tests v1.5
# Version Released: 01/27/2019
# Author: Connor Sanders
# Tested on Python 2.7, 3.3, 3.4, 3.5, 3.6, and 3.7
# Copyright (c) 2019 Connor Sanders
# MIT License

import sys
import datetime
from yahoofinancials import YahooFinancials

if sys.version_info < (2, 7):
Expand Down
5 changes: 2 additions & 3 deletions yahoofinancials/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""
==============================
The Yahoo Financials Module
Version: 1.4
Version: 1.5
==============================
Author: Connor Sanders
Email: [email protected]
Version Released: 01/13/2019
Version Released: 01/27/2019
Tested on Python 2.7, 3.3, 3.4, 3.5, 3.6, and 3.7
Copyright (c) 2019 Connor Sanders
Expand Down Expand Up @@ -569,7 +569,6 @@ def get_stock_dividend_data(self, start, end, interval):
re_data.update({tick: div_data})
except:
re_data.update({tick: None})
print(re_data)
return re_data


Expand Down

0 comments on commit 76fe4ab

Please sign in to comment.