-
Notifications
You must be signed in to change notification settings - Fork 0
/
stock.py
45 lines (45 loc) · 1.32 KB
/
stock.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import scrap
import mail
from credentials import getKeys
from datetime import datetime,date
import sys
#if __name__=="__main__":
def sendAlertMail():
urlBoard="http://www.moneycontrol.com/stocks/marketinfo/meetings.php?opttopic=brdmeeting"
urlSplit="http://www.moneycontrol.com/stocks/marketinfo/splits/index.php"
today=date.today()
eid,pwd=getKeys()
"""------------
scrap url split
------------"""
alertSplit=scrap.stockAlert(urlSplit)
alertSplit.collect()
m,p=alertSplit.scrapSplit()
"""------------
scrap meeting
------------"""
alertBoard=scrap.stockAlert(urlBoard)
alertBoard.collect()
alertBoard.scrapEvents()
d=alertBoard.getTmrQtly()
"""------------
mailing part
------------"""
smail=mail.Email(eid,pwd,"Stock-Alert",["emailID"])
if(d):
a,b=smail.sendEvent(d,"Quaterly Meeting Tomorrow")
if(m):
a,b=smail.sendSplit(m,"Split Today")
if today.day==1:
s=alertBoard.getMonthQtly()
a,b=smail.sendEvent(s,"Monthly Quaterly Meeting")
smail.sendMail()
smail.quit()
sys.exit()
if today.weekday()==6:
if(p):
a,b=smail.sendSplit(p,"Weekly Split")
s=alertBoard.getWeekQtly()
a,b=smail.sendEvent(s,"Weekly Quaterly Meeting")
smail.sendMail()
smail.quit()