Skip to content

Commit

Permalink
added an example using the library
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo Damele committed Apr 22, 2020
1 parent 3a3d0aa commit f2e65e8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/python3

from finviz.helper_functions.save_data import export_to_db, export_to_csv
from finviz.screener import Screener
from finviz.main_func import *

#filters = []
#filters = ['geo_usa']
filters = ['idx_sp500'] # Shows companies in the S&P500
print("Filtering stocks..")
stock_list = Screener(filters=filters, order='ticker')
print("Parsing every stock..")
stock_list.get_ticker_details()

# Export the screener results to CSV file
stock_list.to_csv('sp500.csv')

# Create a SQLite database
#stock_list.to_sqlite('sp500.sqlite')

0 comments on commit f2e65e8

Please sign in to comment.