diff --git a/docs/conf.py b/docs/conf.py index 5f97ccd..d5b5b03 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,7 @@ author = 'Tianning Li' # The full version, including alpha/beta/rc tags -release = '0.4' +release = '0.4.1' # -- General configuration --------------------------------------------------- diff --git a/docs/group.rst b/docs/group.rst index adede21..f45d300 100644 --- a/docs/group.rst +++ b/docs/group.rst @@ -20,3 +20,9 @@ Performance .. automodule:: finvizfinance.group.performance :members: + +Spectrum +============= + +.. automodule:: finvizfinance.group.spectrum + :members: diff --git a/finvizfinance/group/spectrum.py b/finvizfinance/group/spectrum.py new file mode 100644 index 0000000..140facc --- /dev/null +++ b/finvizfinance/group/spectrum.py @@ -0,0 +1,37 @@ +from finvizfinance.group.overview import Overview +from finvizfinance.util import webScrap, imageScrap + +""" +.. module:: group.spectrum + :synopsis: group spectrum image. + +.. moduleauthor:: Tianning Li +""" + +class Spectrum(Overview): + """Spectrum inherit from overview module. + Getting information from the finviz group spectrum page. + """ + def __init__(self): + """initiate module + """ + self.BASE_URL = 'https://finviz.com/groups.ashx?{group}&v=310' + self.url = self.BASE_URL.format(group='g=sector') + Overview._loadSetting(self) + + def ScreenerView(self, group='Sector', order='Name', out_dir=''): + """Get screener table. + + Args: + group(str): choice of group option + order(str): sort the table by the choice of order + """ + if group not in self.group_dict: + raise ValueError() + if order not in self.order_dict: + raise ValueError() + self.url = self.BASE_URL.format(group=self.group_dict[group])+'&'+self.order_dict[order] + + soup = webScrap(self.url) + url = 'https://finviz.com/' + soup.findAll('img')[5]['src'] + imageScrap(url, group, '') \ No newline at end of file diff --git a/setup.py b/setup.py index dad9d81..be8e4b2 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ HERE = pathlib.Path(__file__).parent -VERSION = '0.4' +VERSION = '0.4.1' PACKAGE_NAME = 'finvizfinance' AUTHOR = 'Tianning Li' AUTHOR_EMAIL = 'ltianningli@gmail.com'