Git Product home page Git Product logo

finviz's Introduction

finviz-api ######## Unofficial Python API for FinViz

image

image

Stargazers

image

image

Installation -----The package has been uploaded to PyPi, so you can install the latest release using:

$ pip install finviz

What is Finviz? ===== 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.

Important Information

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.

Using Screener =====

from finviz.screener import Screener

filters = ['exch_nasd', 'idx_sp500']  # Shows companies in NASDAQ which are in the S&P500
# Get the first 50 results sorted by price ascending
stock_list = Screener(filters=filters, order='price')

# Export the screener results to .csv 
stock_list.to_csv()

# Create a SQLite database 
stock_list.to_sqlite()

for stock in stock_list[9:19]:  # Loop through 10th - 20th stocks 
    print(stock['Ticker'], stock['Price']) # Print symbol and price

# Add more filters
stock_list.add(filters=['fa_div_high'])  # Show stocks with high dividend yield
# or just stock_list(filters=['fa_div_high'])

# Print the table into the console
print(stock_list)

image

Using Portfolio ===== .. code:: python

from finviz.portfolio import Portfolio

portfolio = Portfolio('<your-email-address>', '<your-password>', '<portfolio-name>') # Print the portfolio into the console print(portfolio)

Note that, portfolio name is optional - it would assume your default portfolio (if you have one) if you exclude it. The Portfolio class can also create new portfolio from an existing .csv file. The .csv file must be in the following format:

Ticker Transaction Date (Opt.) Shares Price (Opt.)
AAPL 1 05-25-2017 34 141.28
NVDA 2 250 243.32
WMT 1 01.19.2019 45

Note that, if any optional fields are left empty, the API will assign them today's data.

portfolio.create_portfolio('<portfolio-name>', '<path-to-csv-file>')

Individual stocks =====

>>> import finviz
>>> finviz.get_stock('AAPL')
{'Index': 'DJIA S&P500', 'P/E': '12.91', 'EPS (ttm)': '12.15',...
>>> finviz.get_insider('АAPL')
[{'Insider Trading': 'KONDO CHRIS', 'Relationship': 'Principal Accounting Officer', 'Date': 'Nov 19', 'Transaction':            'Sale', 'Cost': '190.00', '#Shares': '3,408', 'Value ($)': '647,520', '#Shares Total': '8,940', 'SEC Form 4': 'Nov 21           06:31 PM'},...
>>> finviz.get_news('AAPL')
[('Chinas Economy Slows to the Weakest Pace Since 2009', 'https://finance.yahoo.com/news/china-economy-slows-weakest-pace-      020040147.html'),...

Downloading charts =====

# Monthly, Candles, Large, No Technical Analysis
stock_list.get_charts(period='m', chart_type='c', size='l', ta=False)

# period='d' > daily 
# period='w' > weekly
# period='m' > monthly

# chart_type='c' > candle
# chart_type='l' > lines

# size='m' > small
# size='l' > large

# ta=True > display technical analysis
# ta=False > ignore technical analysis

Documentation =====

You can read the rest of the documentation inside the docstrings.

Contributing ===== You can contribute to the project by reporting bugs, suggesting enhancements, or directly by extending and writing features (see the ongoing projects).

You can also buy me a coffee!

image

finviz's People

Contributors

alisaraa avatar mariostoev avatar ramboman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.