Downloads · 30 days
0
Nikobreadegg/test_4
test_4 is a machine learning model from Nikobreadegg. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
import streamlit as st import yfinance as yf import pandas as pd import pandasta as ta
Downloads · 30 days
0
Access
Public
Updated Aug 6, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 57%
From the Hugging Face model README
import streamlit as st import yfinance as yf import pandas as pd import pandas_ta as ta
st.title('Stock Technical Indicators App')
ticker = st.text_input('Enter Stock Ticker', 'AAPL')
if ticker: # Fetch data from Yahoo Finance data = yf.download(ticker, start="2020-01-01")
if not data.empty:
# Display raw data
st.subheader('Raw Data')
st.write(data.tail())
# Calculate technical indicators using pandas_ta
data['SMA'] = ta.sma(data['Close'], length=20)
data['EMA'] = ta.ema(data['Close'], length=20)
data['RSI'] = ta.rsi(data['Close'], length=14)
# Display technical indicators
st.subheader('Technical Indicators')
st.write(data[['Close', 'SMA', 'EMA', 'RSI']].tail())
# Plotting
st.subheader('Stock Price and SMA/EMA')
st.line_chart(data[['Close', 'SMA', 'EMA']])
st.subheader('RSI')
st.line_chart(data['RSI'])
else:
st.error('Invalid stock ticker or no data available. Please try again.')
else: st.warning('Please enter a stock ticker.')