Skip to content

Commit 19935e2

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents f61c7b0 + 39316e8 commit 19935e2

File tree

3 files changed

+150
-84
lines changed

3 files changed

+150
-84
lines changed

README.md

-71
This file was deleted.

README.rst

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
finviz-api
2+
########
3+
*Unofficial Python API for FinViz*
4+
5+
.. image:: https://badge.fury.io/py/finviz.svg
6+
:target: https://badge.fury.io/py/finviz
7+
8+
.. image:: https://img.shields.io/badge/python-3.6-blue.svg
9+
:target: https://www.python.org/downloads/release/python-360/
10+
11+
.. image:: https://img.shields.io/github/stars/mariostoev/finviz.svg
12+
:target: https://github.com/mariostoev/finviz/stargazers
13+
:alt: Stargazers
14+
15+
.. image:: https://pepy.tech/badge/finviz
16+
:target: https://pepy.tech/project/finviz
17+
18+
.. image:: http://hits.dwyl.io/mariostoev/finviz.svg
19+
:target: http://hits.dwyl.io/mariostoev/finviz
20+
21+
Installation
22+
-----
23+
The package has been uploaded to PyPi_, so you can install the latest release using:
24+
25+
.. _PyPi: https://pypi.org/project/finviz/
26+
27+
.. code:: bash
28+
29+
$ pip install finviz
30+
31+
What is Finviz?
32+
=====
33+
FinViz_ aims to make market information accessible and provides a lot of data in visual snapshots, allowing traders and investors to quickly find the stock, future or forex pair they are looking for. The site provides advanced screeners, market maps, analysis, comparative tools and charts.
34+
35+
.. _FinViz: https://finviz.com/
36+
37+
**Important Information**
38+
39+
Any quotes data displayed on finviz.com is delayed by 15 minutes for NASDAQ, and 20 minutes for NYSE and AMEX. This API should **NOT** be used for live trading, it's main purpuse is financial analysis, research and data scraping.
40+
41+
Using Screener
42+
=====
43+
44+
.. code:: python
45+
46+
from finviz.screener import Screener
47+
48+
filters = ['exch_nasd', 'idx_sp500'] # Shows companies in NASDAQ which are in the S&P500
49+
# Get the first 50 results sorted by price ascending
50+
stock_list = Screener(filters=filters, order='price')
51+
52+
# Export the screener results to .csv
53+
stock_list.to_csv()
54+
55+
# Create a SQLite database
56+
stock_list.to_sqlite()
57+
58+
for stock in stock_list[9:19]: # Loop through 10th - 20th stocks
59+
print(stock['Ticker'], stock['Price']) # Print symbol and price
60+
61+
# Add more filters
62+
stock_list.add(filters=['fa_div_high']) # Show stocks with high dividend yield
63+
# or just stock_list(filters=['fa_div_high'])
64+
65+
# Print the table into the console
66+
print(stock_list)
67+
68+
.. image:: https://i.imgur.com/cb7UdxB.png
69+
70+
Using Portfolio
71+
=====
72+
.. code:: python
73+
74+
from finviz.portfolio import Portfolio
75+
76+
portfolio = Portfolio('<your-email-address>', '<your-password>', '<portfolio-name>')
77+
# Print the portfolio into the console
78+
print(portfolio)
79+
80+
*Note that, portfolio name is optional - it would assume your default portfolio (if you have one) if you exclude it.*
81+
The Portfolio class can also create new portfolio from an existing ``.csv`` file. The ``.csv`` file must be in the following format:
82+
83+
84+
.. list-table::
85+
:header-rows: 1
86+
87+
* - Ticker
88+
- Transaction
89+
- Date (Opt.)
90+
- Shares
91+
- Price (Opt.)
92+
* - AAPL
93+
- 1
94+
- 05-25-2017
95+
- 34
96+
- 141.28
97+
* - NVDA
98+
- 2
99+
-
100+
- 250
101+
- 243.32
102+
* - WMT
103+
- 1
104+
- 01.19.2019
105+
- 45
106+
-
107+
108+
Note that, if any *optional* fields are left empty, the API will assign them today's data.
109+
110+
.. code:: python
111+
112+
portfolio.create_portfolio('<portfolio-name>', '<path-to-csv-file>')
113+
114+
Downloading charts
115+
=====
116+
117+
.. code:: python
118+
119+
# Monthly, Candles, Large, No Technical Analysis
120+
stock_list.get_charts(period='m', chart_type='c', size='l', ta=False)
121+
122+
# period='d' > daily
123+
# period='w' > weekly
124+
# period='m' > monthly
125+
126+
# chart_type='c' > candle
127+
# chart_type='l' > lines
128+
129+
# size='m' > small
130+
# size='l' > large
131+
132+
# ta=True > display technical analysis
133+
# ta=False > ignore technical analysis
134+
135+
136+
Documentation
137+
=====
138+
139+
You can read the rest of the documentation inside the docstrings.
140+
141+
Contributing
142+
=====
143+
You can contribute to the project by reporting bugs, suggesting enhancements, or directly by extending and writing features (see the ongoing projects_).
144+
145+
.. _projects: https://github.com/mariostoev/finviz/projects/1
146+
147+
*You can also buy me a coffee!*
148+
149+
.. image:: http://rickrduncan.com/wp-content/uploads/2017/11/buy-me-coffee-paypal.png
150+
:target: https://www.paypal.me/finvizapi

finviz/portfolio.py

-13
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,6 @@ def create_portfolio(self, name, file):
103103

104104
self._session.post(PORTFOLIO_SUBMIT_URL, data=data)
105105

106-
def __portfolio_exists(self, func):
107-
""" Private function used to check whether the user has an existing portfolio. """
108-
109-
def wrapper(*args, **kwargs):
110-
if not self.created:
111-
raise NoPortfolio(func.__name__)
112-
113-
out = func(*args, **kwargs)
114-
115-
return out
116-
117-
return wrapper
118-
119106
def __get_portfolio_url(self, portfolio_name):
120107
""" Private function used to return the portfolio url from a given id/name. """
121108

0 commit comments

Comments
 (0)