Skip to content

Commit 45ab850

Browse files
Merge pull request #2015 from Rjchauhan18/master
Added News_App for indian Stock market
2 parents 0085020 + 77b464c commit 45ab850

File tree

4 files changed

+202
-0
lines changed

4 files changed

+202
-0
lines changed

News_App/Newsapp.py

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import os
2+
import solara as sr
3+
import yfinance as yf
4+
5+
6+
from patterns import Company_Name
7+
from datetime import datetime as date,timedelta
8+
9+
srart_date = date.today()
10+
end_date = date.today() + timedelta(days=1)
11+
12+
13+
def News(symbol):
14+
get_Data = yf.Ticker(symbol)
15+
16+
#news section
17+
try:
18+
NEWS = get_Data.news
19+
sr.Markdown(f"# News of {v.value} :")
20+
for i in range(len(NEWS)):
21+
sr.Markdown("\n********************************\n")
22+
sr.Markdown(f"## {i+1}. {NEWS[i]['title']} \n ")
23+
sr.Markdown(f"**Publisher** : {NEWS[i]['publisher']}\n")
24+
sr.Markdown(f"**Link** : {NEWS[i]['link']}\n")
25+
sr.Markdown(f"**News type** : {NEWS[i]['type']}\n\n\n")
26+
try:
27+
28+
resolutions = NEWS[i]['thumbnail']['resolutions']
29+
img = resolutions[0]['url']
30+
sr.Image(img)
31+
32+
except:
33+
pass
34+
except Exception as e:
35+
sr.Markdown(e)
36+
sr.Markdown("No news available")
37+
38+
39+
40+
41+
company = list(Company_Name.keys())
42+
v=sr.reactive(company[0])
43+
44+
@sr.component
45+
def Page():
46+
with sr.Column() as main:
47+
with sr.Sidebar():
48+
sr.Markdown("## **stock Analysis**")
49+
sr.Select("Select stock",value=v,values=company)
50+
51+
select=Company_Name.get(v.value)
52+
53+
54+
News(select)
55+
56+
return main
57+

News_App/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## News App
2+
3+
- I have create News app using python solara framework and yfinace for getting news of stocks.
4+
5+
Steps to run the app:
6+
7+
1. Clone the repositery and go to the `News_App` and Install all the requirements
8+
9+
```
10+
pip install -r requirements.txt
11+
```
12+
13+
2. Run the solara app
14+
15+
```
16+
solara run Newsapp.py
17+
```

News_App/patterns.py

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
2+
3+
4+
patterns = {
5+
'CDLHARAMI':'Harami Pattern',
6+
'CDLHARAMICROSS':'Harami Cross Pattern',
7+
'CDL2CROWS':'Two Crows',
8+
'CDL3BLACKCROWS':'Three Black Crows',
9+
'CDL3INSIDE':'Three Inside Up/Down',
10+
'CDL3LINESTRIKE':'Three-Line Strike',
11+
'CDL3OUTSIDE':'Three Outside Up/Down',
12+
'CDL3STARSINSOUTH':'Three Stars In The South',
13+
'CDL3WHITESOLDIERS':'Three Advancing White Soldiers',
14+
'CDLABANDONEDBABY':'Abandoned Baby',
15+
'CDLADVANCEBLOCK':'Advance Block',
16+
'CDLBELTHOLD':'Belt-hold',
17+
'CDLBREAKAWAY':'Breakaway',
18+
'CDLCLOSINGMARUBOZU':'Closing Marubozu',
19+
'CDLCONCEALBABYSWALL':'Concealing Baby Swallow',
20+
'CDLCOUNTERATTACK':'Counterattack',
21+
'CDLDARKCLOUDCOVER':'Dark Cloud Cover',
22+
'CDLDOJI':'Doji',
23+
'CDLDOJISTAR':'Doji Star',
24+
'CDLDRAGONFLYDOJI':'Dragonfly Doji',
25+
'CDLENGULFING':'Engulfing Pattern',
26+
'CDLEVENINGDOJISTAR':'Evening Doji Star',
27+
'CDLEVENINGSTAR':'Evening Star',
28+
'CDLGAPSIDESIDEWHITE':'Up/Down-gap side-by-side white lines',
29+
'CDLGRAVESTONEDOJI':'Gravestone Doji',
30+
'CDLHAMMER':'Hammer',
31+
'CDLHANGINGMAN':'Hanging Man',
32+
'CDLHIGHWAVE':'High-Wave Candle',
33+
'CDLHIKKAKE':'Hikkake Pattern',
34+
'CDLHIKKAKEMOD':'Modified Hikkake Pattern',
35+
'CDLHOMINGPIGEON':'Homing Pigeon',
36+
'CDLIDENTICAL3CROWS':'Identical Three Crows',
37+
'CDLINNECK':'In-Neck Pattern',
38+
'CDLINVERTEDHAMMER':'Inverted Hammer',
39+
'CDLKICKING':'Kicking',
40+
'CDLKICKINGBYLENGTH':'Kicking - bull/bear determined by the longer marubozu',
41+
'CDLLADDERBOTTOM':'Ladder Bottom',
42+
'CDLLONGLEGGEDDOJI':'Long Legged Doji',
43+
'CDLLONGLINE':'Long Line Candle',
44+
'CDLMARUBOZU':'Marubozu',
45+
'CDLMATCHINGLOW':'Matching Low',
46+
'CDLMATHOLD':'Mat Hold',
47+
'CDLMORNINGDOJISTAR':'Morning Doji Star',
48+
'CDLMORNINGSTAR':'Morning Star',
49+
'CDLONNECK':'On-Neck Pattern',
50+
'CDLPIERCING':'Piercing Pattern',
51+
'CDLRICKSHAWMAN':'Rickshaw Man',
52+
'CDLRISEFALL3METHODS':'Rising/Falling Three Methods',
53+
'CDLSEPARATINGLINES':'Separating Lines',
54+
'CDLSHOOTINGSTAR':'Shooting Star',
55+
'CDLSHORTLINE':'Short Line Candle',
56+
'CDLSPINNINGTOP':'Spinning Top',
57+
'CDLSTALLEDPATTERN':'Stalled Pattern',
58+
'CDLSTICKSANDWICH':'Stick Sandwich',
59+
'CDLTAKURI':'Takuri (Dragonfly Doji with very long lower shadow)',
60+
'CDLTASUKIGAP':'Tasuki Gap',
61+
'CDLTHRUSTING':'Thrusting Pattern',
62+
'CDLTRISTAR':'Tristar Pattern',
63+
'CDLUNIQUE3RIVER':'Unique 3 River',
64+
'CDLUPSIDEGAP2CROWS':'Upside Gap Two Crows',
65+
'CDLXSIDEGAP3METHODS':'Upside/Downside Gap Three Methods'
66+
}
67+
68+
Company_Name ={
69+
"NIFTY 50" :"^NSEI",
70+
"NIFTY BANK" : "^NSEBANK",
71+
"INDIA VIX" : "^INDIAVIX",
72+
"ADANI ENTERPRISES ":"ADANIENT.NS",
73+
"ADANI PORTS AND SPECIAL ECONOMIC ZONE ":"ADANIPORTS.NS",
74+
"APOLLO HOSPITALS ENTERPRISE ":"APOLLOHOSP.NS",
75+
"ASIAN PAINTS ":"ASIANPAINT.NS",
76+
"Axis Bank ":"AXISBANK.NS",
77+
"MARUTI SUZUKI INDIA ":"MARUTI.NS",
78+
"BAJAJ FINANCE ":"BAJFINANCE.NS",
79+
"Bajaj Finserv ":"BAJAJFINSV.NS",
80+
"BHARAT PETROLEUM CORPORATION ":"BPCL.NS",
81+
"Bharti Airtel ":"BHARTIARTL.NS", # change
82+
"BRITANNIA INDUSTRIES LTD" :"BRITANNIA.NS",
83+
"CIPLA ":"CIPLA.NS",
84+
"COAL INDIA LTD " :"COALINDIA.NS",
85+
"DIVI'S LABORATORIES ":"DIVISLAB.NS",
86+
"DR.REDDY'S LABORATORIES LTD ":"DRREDDY.NS",
87+
"EICHER MOTORS ":"EICHERMOT.NS",
88+
"GRASIM INDUSTRIES LTD ":"GRASIM.NS",
89+
"HCL TECHNOLOGIES ":"HCLTECH.NS",
90+
"HDFC BANK ":"HDFCBANK.NS",
91+
"HDFC LIFE INSURANCE COMPANY ":"HDFCLIFE.NS",
92+
"Hero MotoCorp ":"HEROMOTOCO.NS",
93+
"HINDALCO INDUSTRIES ":"HINDALCO.NS",
94+
"HINDUSTAN UNILEVER ":"HINDUNILVR.NS",
95+
"HOUSING DEVELOPMENT FINANCE CORPORATION ":"HDFC.NS",
96+
"ICICI BANK ":"ICICIBANK.NS",
97+
"ITC ":"ITC.NS",
98+
"INDUSIND BANK LTD. ":"INDUSINDBK.NS",
99+
"INFOSYS ":"INFY.NS",
100+
"JSW Steel ":"JSWSTEEL.NS",
101+
"KOTAK MAHINDRA BANK ":"KOTAKBANK.NS",
102+
"LARSEN AND TOUBRO ":"LT.NS",
103+
"MAHINDRA AND MAHINDRA ":"M&M.NS",
104+
"MARUTI SUZUKI INDIA ":"MARUTI.NS",
105+
"NTPC ":"NTPC.NS",
106+
"NESTLE INDIA ":"NESTLEIND.NS",
107+
"OIL AND NATURAL GAS CORPORATION ":"ONGC.NS",
108+
"POWER GRID CORPORATION OF INDIA ":"POWERGRID.NS",
109+
"RELIANCE INDUSTRIES ":"RELIANCE.NS", #cahnged
110+
"SBI LIFE INSURANCE COMPANY ":"SBILIFE.NS",
111+
"SBI":"SBIN.NS",
112+
"SUN PHARMACEUTICAL INDUSTRIES ":"SUNPHARMA.NS",
113+
"TATA CONSULTANCY SERVICES ":"TCS.NS",
114+
"TATA CONSUMER PRODUCTS ":"TATACONSUM.NS",
115+
"TATA MOTORS ":"TATAMTRDVR.NS",
116+
"TATA STEEL ":"TATASTEEL.NS",
117+
"TECH MAHINDRA ":"TECHM.NS",
118+
"TITAN COMPANY ":"TITAN.NS",
119+
"UPL ":"UPL.NS",
120+
"ULTRATECH CEMENT ":"ULTRACEMCO.NS",
121+
"WIPRO ":"WIPRO.NS"
122+
}

News_App/requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
solara == 1.19.0
2+
Flask
3+
gunicorn ==21.2.0
4+
simple-websocket
5+
flask-sock
6+
yfinance

0 commit comments

Comments
 (0)