import os, pandas
import plotly.graph_objects as go
import finnhub
import requests
import pandas as pd
from datetime import datetime
from datetime import timezone
import matplotlib.pyplot as plt
import numpy as np
import math
import mplfinance as mpf
from mplfinance.original_flavor import candlestick_ohlc
import matplotlib.dates as mpl_dates
import time
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style.use("seaborn")
import yfinance as yf
from datetime import date
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import pandas as pd
import mplfinance as mpf
from mplfinance.original_flavor import candlestick_ohlc
import finnhub
import matplotlib.dates as mpl_dates
import numpy as np
from datetime import * 
import seaborn as sns
from datetime import datetime

d =pd.read_csv('stock_lists.csv') 

api_key1 = '8a1cf9d14d53126b05c8a7636fe3d006'

n = 5 # number of groups
groups = np.array_split(symbols, n)
stocks = pd.DataFrame(columns = ['description', 'ticker', 'weburl', 'logo', 'name'])
for group in groups:
    for symb in group:
        comp = requests.get(f'https://finnhub.io/api/v1/stock/profile?symbol={symb}&token={api_key}').json()
        stocks = stocks.append({'description': comp['description'], 'ticker': comp['ticker'], 'weburl': comp['weburl'], 'logo': comp['logo'], 'name': comp['name']}, ignore_index = True)
    
    time.sleep(60)
stocks['Date_access'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
stocks.to_csv('stocks.csv', index = False)

growth tech stock:
quarterly annual growth > 25
1yr %change in EPS(BASIC) > 25 sector technolgoy exchange nasdaqGs, nyse

high growth stock screener:
1) EPS growth 1-year change (%) = over 20%.
2) EPS growth quarter over quarter = over 20%.
3) Sales/revenue growth quarter over quarter = over 20%.
4) EPS Next Year change (Estimate %) (forecast) = over 15%
5) Institutional Ownership = over 30%.
6) Price is over $15


EPS growth 1-year change (%) = over 20%.
2) EPS growth quarter over quarter = over 20%.
3) Sales/revenue growth quarter over quarter = over 20%.
4) EPS Next Year change (Estimate %) (forecast) = over 15%
5) Institutional Ownership = over 30%.
6) Price is over $15
7) EPS growth 3-year avg (%) = over 15%
8) Sales growth 3-year avg (%) = over 15%

    
High Dividend Yield Stock Screening Criteria
Market Capitalization > 2 B
Dividend Yield > 3% < 10%######>1.5%
Dividend 1 Year Change % > 2%
Dividend 3 Year Average % > 2%
Payout Ratio > 30 and < 60

安全股息筛选标准
市值 > 20 亿美元
股息收益率 > 1.5%
股息 1 年变化 % > 0%
股息 3 年平均百分比 > 0%
股息 5 年平均百分比 > 0%
主要交易所（非场外交易）的股票
支付比率 > 30 和 < 50
5 年平均销售额增长 > 4.5%

Long-term Dividend Growth Screening Criteria
Dividend per share $ Y9 > Dividend per share Y8 > Dividend per share Y7 > Dividend per share Y6 > Dividend per share Y5 > Dividend per share Y4 > Dividend per share Y3 > Dividend per share Y2 > Dividend per share Y1 >



Value + Dividend Strategy Screening Criteria
Dividend Yield > 2
Dividend 5 Year Average > 1%
EPS 5 Year Avg > 8%
Price to Book < 1.2
Sales 5 Year Avg > 3%
Payout Ratio < 60
PE Ratio = lowest 2 deciles

big tech:
Facebook, Amazon, Apple, Netflix, and Google (Alphabet).



Large Cap Growth
Market Capitalization	Greater than or Equal to $5.0B
EPS Growth (Proj This Quarter vs. Same Quarter Prior Yr)	Highest 20% for industry
EPS Growth (Proj this Yr vs. Last Yr)	Highest 20% for industry
P/E (This Year's Estimate)	Less than or Equal to 25.0
PEG Ratio	Less than or Equal to 2.0
Security Price	Greater than or Equal to $5.00
Volume (90 Day Average)	Greater than or Equal to 50.0K


undervalued growth stock

Trailing P/E: 0 - 20, Price / Earnings to Growth (P/E/G): < 1, 1 yr. % Change in EPS (Basic): 25% to 50% and 50% to 100% and > 100%, Exchange: NasdaqGS and NYSE

