Skip to content

Commit

Permalink
update version
Browse files Browse the repository at this point in the history
  • Loading branch information
lit26 committed May 8, 2021
1 parent 28e5751 commit 9f5f6dd
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Tianning Li'

# The full version, including alpha/beta/rc tags
release = '0.9.7'
release = '0.9.8'


# -- General configuration ---------------------------------------------------
Expand Down
53 changes: 50 additions & 3 deletions finvizfinance/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
.. moduleauthor:: Tianning Li <[email protected]>
"""
QUOTE_URL = 'https://finviz.com/quote.ashx?t={ticker}'

NUM_COL = ['P/E', 'EPS (ttm)', 'Insider Own', 'Shs Outstand', 'Market Cap', 'Forward P/E',
'EPS nest Y', 'Insider ']

class Quote:
"""quote
Expand Down Expand Up @@ -90,9 +91,12 @@ def TickerCharts(self, timeframe='daily', charttype='advanced', out_dir='', urlo
imageScrap(chart_url, self.ticker, out_dir)
return chart_url

def TickerFundament(self):
def TickerFundament(self, raw=True):
"""Get ticker fundament.
Args:
raw(boolean): if True, the data is raw.
Returns:
fundament(dict): ticker fundament.
"""
Expand All @@ -115,10 +119,53 @@ def TickerFundament(self):
if i % 2 == 0:
header = value
else:
fundament_info[header] = value
if header == 'Volatility':
fundament_info = self._parse_volatility(header, fundament_info, value, raw)
elif header == '52W Range':
fundament_info = self._parse_52w_range(header, fundament_info, value, raw)
elif header == 'Optionable' or header == 'Shortable':
if raw:
fundament_info[header] = value
elif value == 'Yes':
fundament_info[header] = True
else:
fundament_info[header] = False
else:
if raw:
fundament_info[header] = value
else:
try:
fundament_info[header] = numberCovert(value)
except ValueError:
fundament_info[header] = value
self.info['fundament'] = fundament_info
return fundament_info

def _parse_52w_range(self, header, fundament_info, value, raw):
info_header = ['52W Range From', '52W Range To']
info_value = [0, 2]
self._parse_value(header, fundament_info, value, raw, info_header, info_value)
return fundament_info

def _parse_volatility(self, header, fundament_info, value, raw):
info_header = ['Volatility W', 'Volatility M']
info_value = [0, 1]
self._parse_value(header, fundament_info, value, raw, info_header, info_value)
return fundament_info

def _parse_value(self, header, fundament_info, value, raw, info_header, info_value):
try:
value = value.split()
if raw:
for i, value_index in enumerate(info_value):
fundament_info[info_header[i]] = value[value_index]
else:
for i, value_index in enumerate(info_value):
fundament_info[info_header[i]] = numberCovert(value[value_index])
except:
fundament_info[header] = value
return fundament_info

def TickerDescription(self):
"""Get ticker description.
Expand Down
1 change: 1 addition & 0 deletions release.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
| Date | Version | Comment |
| ------------- | ------------- | ------------- |
| 2021/05/08 | 0.9.8 | Adding data type in Quote file.|
| 2021/04/27 | 0.9.7 | Update Value Error message https://github.com/lit26/finvizfinance/issues/23. Adding insider options https://github.com/lit26/finvizfinance/pull/22 |
| 2021/04/18 | 0.9.6 | Increase performance and add timeout https://github.com/lit26/finvizfinance/issues/21.|
| 2021/04/14 | 0.9.5 | Add quarterly statements https://github.com/lit26/finvizfinance/issues/19.|
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

HERE = pathlib.Path(__file__).parent

VERSION = '0.9.7'
VERSION = '0.9.8'
PACKAGE_NAME = 'finvizfinance'
AUTHOR = 'Tianning Li'
AUTHOR_EMAIL = '[email protected]'
Expand Down

0 comments on commit 9f5f6dd

Please sign in to comment.