Skip to content

Commit

Permalink
Merge pull request #35 from lit26/before-release
Browse files Browse the repository at this point in the history
release new version v0.11.0
  • Loading branch information
lit26 authored Dec 12, 2021
2 parents 6b6a01c + 83d757a commit c6f128d
Show file tree
Hide file tree
Showing 36 changed files with 4,943 additions and 1,467 deletions.
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,30 @@ workflows:
branches:
only:
- master
- before-release
- test_py37
- test_py38:
filters:
branches:
only:
- master
- before-release
- test_py39:
filters:
branches:
only:
- master
- before-release
- coverage:
filters:
branches:
only:
- master
# - doc
- before-release


###########################################
# Testing CircleCI in local
###########################################
# circleci local execute --job test_py37
# circleci local execute --job coverage
# circleci local execute --job doc
# circleci local execute --job coverage
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
![PyPI](https://img.shields.io/pypi/v/finvizfinance)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/finvizfinance)
![PyPI - License](https://img.shields.io/pypi/l/finvizfinance?color=gre)
[![Coverage Status](https://coveralls.io/repos/github/lit26/finvizfinance/badge.svg)](https://coveralls.io/github/lit26/finvizfinance)
![Travis (.org)](https://img.shields.io/travis/lit26/finvizfinance)
![Read the Docs](https://img.shields.io/readthedocs/finvizfinance)
[![Downloads](https://pepy.tech/badge/finvizfinance)](https://pepy.tech/project/finvizfinance)
[![CodeFactor](https://www.codefactor.io/repository/github/lit26/finvizfinance/badge/master)](https://www.codefactor.io/repository/github/lit26/finvizfinance/overview/master)
[![Donate PayPal](https://img.shields.io/badge/Donate%20%24-PayPal-brightgreen.svg)](https://www.paypal.me/TIANNINGL/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

# finvizfinance

Expand Down Expand Up @@ -38,20 +40,19 @@ $ pip install finvizfinance
Getting information (fundament, description, outer rating, stock news, inside trader) of an individual stock.

```python
import pandas as pd
from finvizfinance.quote import finvizfinance

stock = finvizfinance('tsla')
```

#### Chart
```python
stock.TickerCharts()
stock.ticker_charts()
```

#### Fundament
```python
stock_fundament = stock.TickerFundament()
stock_fundament = stock.ticker_fundament()

# result
# stock_fundament = {'Company': 'Tesla, Inc.', 'Sector': 'Consumer Cyclical',
Expand All @@ -63,26 +64,26 @@ stock_fundament = stock.TickerFundament()

#### Description
```python
stock_description = stock.TickerDescription()
stock_description = stock.ticker_description()

# stock_description
# stock_description = 'Tesla, Inc. designs, develops, manufactures, ...'
```

#### Outer Ratings
```python
outer_ratings_df = stock.TickerOuterRatings()
outer_ratings_df = stock.ticker_outer_ratings()
```
![Outer Ratings example](asset/outer_rating.png)
#### Stock News
```python
news_df = stock.TickerNews()
news_df = stock.ticker_news()
```
![stock news example](asset/stock_news.png)

#### Inside Trader
```python
inside_trader_df = stock.TickerInsideTrader()
inside_trader_df = stock.ticker_inside_trader()
```
![insider trader example](asset/insider_trader.png)

Expand All @@ -94,7 +95,7 @@ Getting recent financial news from finviz.
from finvizfinance.news import News

fnews = News()
all_news = fnews.getNews()
all_news = fnews.get_news()
```
Finviz News include 'news' and 'blogs'.
```python
Expand All @@ -117,7 +118,7 @@ finsider = Insider(option='top owner trade')
# option: latest, top week, top owner trade
# default: latest

insider_trader = finsider.getInsider()
insider_trader = finsider.get_insider()
```
![insider example](asset/insider.png)

Expand All @@ -133,7 +134,7 @@ from finvizfinance.screener.overview import Overview
foverview = Overview()
filters_dict = {'Index':'S&P 500','Sector':'Basic Materials'}
foverview.set_filter(filters_dict=filters_dict)
df = foverview.ScreenerView()
df = foverview.screener_view()
df.head()
```
![insider example](asset/screen_overview.png)
Expand Down
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.10.1'
release = '0.11.0'


# -- General configuration ---------------------------------------------------
Expand Down
16 changes: 8 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ Example getting individual ticker information

.. code-block:: python
stock_fundament = stock.TickerFundament()
stock_description = stock.TickerDescription()
outer_ratings_df = stock.TickerOuterRatings()
news_df = stock.TickerNews()
inside_trader_df = stock.TickerInsideTrader()
stock_fundament = stock.ticker_fundament()
stock_description = stock.ticker_description()
outer_ratings_df = stock.ticker_outer_ratings()
news_df = stock.ticker_news()
inside_trader_df = stock.ticker_inside_trader()
Screener Example
================
Expand All @@ -52,7 +52,7 @@ Screener Example
foverview = Overview()
filters_dict = {'Exchange':'AMEX','Sector':'Basic Materials'}
foverview.set_filter(filters_dict=filters_dict)
df = foverview.ScreenerView()
df = foverview.screener_view()
df.head()
News Example
Expand All @@ -62,7 +62,7 @@ News Example
from finvizfinance.news import News
fnews = News()
all_news = fnews.getNews()
all_news = fnews.get_news()
# all_news['news'].head()
# all_news['blogs'].head()
Expand All @@ -73,7 +73,7 @@ Insider Example
from finvizfinance.insider import Insider
finsider = Insider(option='top owner trade')
finsider.getInsider().head()
finsider.get_insider().head()
Contents
==================
Expand Down
2,692 changes: 1,911 additions & 781 deletions example/example.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion finvizfinance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
.. moduleauthor:: Tianning Li <[email protected]>
"""

__version__ = "0.10"
__version__ = "0.11.0"
__author__ = "Tianning Li"
46 changes: 28 additions & 18 deletions finvizfinance/calendar.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
import pandas as pd
from finvizfinance.util import webScrap
from finvizfinance.util import web_scrap

"""
.. module:: calendar
:synopsis: calendar.
Expand All @@ -13,9 +14,9 @@ class Calendar:
"""Calendar
Getting information from the finviz calendar page.
"""

def __init__(self):
"""initiate module
"""
"""initiate module"""
pass

def calendar(self):
Expand All @@ -24,28 +25,37 @@ def calendar(self):
Returns:
df(pandas.DataFrame): economic calendar table
"""
soup = webScrap("https://finviz.com/calendar.ashx")
tables = soup.findAll('table', class_='calendar')
columns = ['Datetime', 'Release', 'Impact', 'For', 'Actual', 'Expected', 'Prior']
soup = web_scrap("https://finviz.com/calendar.ashx")
tables = soup.findAll("table", class_="calendar")
columns = [
"Datetime",
"Release",
"Impact",
"For",
"Actual",
"Expected",
"Prior",
]
df = pd.DataFrame([], columns=columns)

for table in tables:
rows = table.findAll('tr')
rows = table.findAll("tr")
# check row
if rows[1].findAll('td')[2].text != 'No economic releases':
if rows[1].findAll("td")[2].text != "No economic releases":
# parse date
date = rows[0].find('td').text
date = rows[0].find("td").text
for row in rows[1:]:
cols = row.findAll('td')
cols = row.findAll("td")
info_dict = {
'Datetime': '{}, {}'.format(date, cols[0].text),
'Release': cols[2].text,
'Impact': re.findall('gfx/calendar/impact_(.*).gif',
cols[3].find('img')['src'])[0],
'For': cols[4].text,
'Actual': cols[5].text,
'Expected': cols[6].text,
'Prior': cols[7].text
"Datetime": "{}, {}".format(date, cols[0].text),
"Release": cols[2].text,
"Impact": re.findall(
"gfx/calendar/impact_(.*).gif", cols[3].find("img")["src"]
)[0],
"For": cols[4].text,
"Actual": cols[5].text,
"Expected": cols[6].text,
"Prior": cols[7].text,
}
df = df.append(info_dict, ignore_index=True)
return df
19 changes: 10 additions & 9 deletions finvizfinance/crypto.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from finvizfinance.util import scrapFunction, imageScrapFunction
from finvizfinance.util import scrap_function, image_scrap_function

"""
.. module:: crypto
:synopsis: crypto information
Expand All @@ -12,9 +13,9 @@ class Crypto:
Getting information from the finviz crypto page.
"""

def __init__(self):
"""initiate module
"""
"""initiate module"""
pass

def performance(self):
Expand All @@ -23,11 +24,11 @@ def performance(self):
Returns:
df(pandas.DataFrame): crypto performance table
"""
url = 'https://finviz.com/crypto_performance.ashx'
df = scrapFunction(url)
url = "https://finviz.com/crypto_performance.ashx"
df = scrap_function(url)
return df

def chart(self, crypto, timeframe='D', urlonly=False):
def chart(self, crypto, timeframe="D", urlonly=False):
"""Get crypto chart.
Args:
Expand All @@ -38,6 +39,6 @@ def chart(self, crypto, timeframe='D', urlonly=False):
charturl(str): url for the chart
"""

url = 'https://finviz.com/crypto_charts.ashx?t=ALL&tf='
charturl = imageScrapFunction(url, crypto, timeframe, urlonly)
return charturl
url = "https://finviz.com/crypto_charts.ashx?t=ALL&tf="
charturl = image_scrap_function(url, crypto, timeframe, urlonly)
return charturl
Loading

0 comments on commit c6f128d

Please sign in to comment.