forked from Derrick-Sherrill/DerrickSherrill.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckVolume.py
29 lines (25 loc) · 881 Bytes
/
CheckVolume.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import yfinance as yf
import pandas as pd
df = pd.read_csv('companylist.csv')
print(df['Symbol'])
increased_volume = []
for stock in df['Symbol']:
stock = stock.upper()
if '^' in stock:
pass
else:
try:
stock_info = yf.Ticker(stock)
hist = stock_info.history(period="5d")
previous_averaged_volume = hist['Volume'].iloc[1:4:1].mean()
todays_volume = hist['Volume'][-1]
previous_close = hist['Close'][-2]
current_close = hist['Close'][-1]
if todays_volume > previous_averaged_volume * 4 and previous_close < current_close and todays_volume > 100000:
print(stock)
print(previous_averaged_volume)
print(todays_volume)
increased_volume.append(stock)
except:
pass
print(increased_volume)