-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarket-mood-index.py
37 lines (22 loc) · 942 Bytes
/
market-mood-index.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
import requests
from bs4 import BeautifulSoup
page = requests.get('https://www.tickertape.in/market-mood-index')
soup = BeautifulSoup(page.content, 'html.parser')
# title = soup.title.text
first_h1 = soup.select('h1')[0].text
seventh_p_text = soup.select('p')[6].text
market_mood_index = first_h1+" : "+seventh_p_text
mmi = float(seventh_p_text)
if mmi > 80:
comment = "High Extreme Greed Zone, Do not open new positions, Markets are overbought and likely to turn downwards"
elif mmi > 70:
comment = "Extreme Greed Zone, Keep tracking actively"
elif mmi > 50:
comment = "Greed Zone, No need to react"
elif mmi > 30:
comment = "Fear Zone, No need to react"
elif mmi > 20:
comment = "Extreme Fear Zone, Keep tracking actively"
else:
comment = "High Extreme Fear Zone, Good time to open fresh positions, Markets are likely to be oversold and soon might turn upwards"
print(market_mood_index+"\n"+comment )