File size: 1,042 Bytes
d09cb6c
47d147b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e7ce3ee
 
 
 
3aad77e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e7ce3ee
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
import streamlit as st
import numpy as np 
import pandas as pd 
import matplotlib.pyplot as plt
import yfinance as yf
yf.pdr_override()
from pandas_datareader import data as pdr

start = '2005-01-01'
end = '2022-12-31'

st.title("Stock Market Trend Predictor")

user_input = st.text_input("Enter the stock ticker", "TATAPOWER.NS")
df = pdr.get_data_yahoo(user_input, start, end)

st.subheader("Data from year 2005 to 2022:")
st.write(df.describe())

st.subheader("Closing Price VS Time Chart:")
fig = plt.figure(figsize=(12,6))
plt.plot(df.Close)
st.pyplot(fig)

moving_avg_100 = df.Close.rolling(100).mean()
st.subheader("Closing Price VS Time Chart With 100Moving Average:")
fig = plt.figure(figsize=(12,6))
plt.plot(df.Close)
plt.plot(moving_avg_100,'red')
st.pyplot(fig)

moving_avg_200 = df.Close.rolling(200).mean()
st.subheader("Closing Price VS Time Chart With 100Moving Average and 200Moving Average:")
fig = plt.figure(figsize=(12,6))
plt.plot(df.Close)
plt.plot(moving_avg_100,'red')
plt.plot(moving_avg_200,'green')
st.pyplot(fig)