Skip to content

Commit

Permalink
update version
Browse files Browse the repository at this point in the history
  • Loading branch information
lit26 committed Oct 2, 2020
1 parent 7f217d5 commit dc951bb
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/future.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Future
**************************

Getting future information.

.. automodule:: finvizfinance.future
:members:



1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Contents
Insider <insider>
Forex <forex>
Crypto <crypto>
Future <future>
Earnings <earnings>


Expand Down
50 changes: 50 additions & 0 deletions finvizfinance/future.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from finvizfinance.util import webScrap, imageScrapFunction
import pandas as pd
import json

"""
.. module:: future
:synopsis: future.
.. moduleauthor:: Tianning Li <ltianningli@gmail.com>
"""

class Future:
"""Future
Getting information from the finviz future page.
"""
def __init__(self):
"""initiate module
"""
pass

def performance(self, timeframe='D'):
"""Get forex performance table.
Args:
timeframe (str): choice of timeframe(D, W, M, Q, HY, Y)
Returns:
df(pandas.DataFrame): forex performance table
"""
params = None
if timeframe == 'D':
params = ''
elif timeframe == 'W':
params = '?v=12'
elif timeframe == 'M':
params = '?v=13'
elif timeframe == 'Q':
params = '?v=14'
elif timeframe == 'HY':
params = '?v=15'
elif timeframe == 'Y':
params = '?v=16'
else:
raise ValueError()

soup = webScrap('https://finviz.com/futures_performance.ashx'+params)
data = soup.text[soup.text.find('var rows = ')+11:soup.text.find('FinvizInitFuturesPerformance(rows);')]
data = json.loads(data.strip()[:-1])
df = pd.DataFrame(data)
return df
1 change: 1 addition & 0 deletions finvizfinance/group/overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def ScreenerView(self, group='Sector', order='Name'):
Args:
group(str): choice of group option.
order(str): sort the table by the choice of order.
Returns:
df(pandas.DataFrame): group information table.
"""
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 |
| ------------- | ------------- | ------------- |
| 2020/10/01 | 0.7.1 | Adding future module |
| 2020/09/19 | 0.7 | Adding top K rows in the screener dataframe and update request error |
| 2020/08/21 | 0.6.2 | Update printing |
| 2020/08/17 | 0.6.1 | Fix PyPi package error |
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.7'
VERSION = '0.7.1'
PACKAGE_NAME = 'finvizfinance'
AUTHOR = 'Tianning Li'
AUTHOR_EMAIL = 'ltianningli@gmail.com'
Expand Down

0 comments on commit dc951bb

Please sign in to comment.