Skip to content

Instantly share code, notes, and snippets.

@shashankvemuri
Last active August 8, 2020 06:52
Show Gist options
  • Save shashankvemuri/e70c9ab20fc4de4876c7ac13ee7a9bc6 to your computer and use it in GitHub Desktop.
Save shashankvemuri/e70c9ab20fc4de4876c7ac13ee7a9bc6 to your computer and use it in GitHub Desktop.
Introduction to the web app
st.write("""
# Technical Analysis Web Application
Shown below are the **Moving Average Crossovers**, **Bollinger Bands**, **MACD's**, **Commodity Channel Indexes**, and **Relative Strength Indexes** of any stock!
""")
st.sidebar.header('User Input Parameters')
today = datetime.date.today()
def user_input_features():
ticker = st.sidebar.text_input("Ticker", 'AAPL')
start_date = st.sidebar.text_input("Start Date", '2019-01-01')
end_date = st.sidebar.text_input("End Date", f'{today}')
return ticker, start_date, end_date
symbol, start, end = user_input_features()
def get_symbol(symbol):
url = "http://d.yimg.com/autoc.finance.yahoo.com/autoc?query={}&region=1&lang=en".format(symbol)
result = requests.get(url).json()
for x in result['ResultSet']['Result']:
if x['symbol'] == symbol:
return x['name']
company_name = get_symbol(symbol.upper())
start = pd.to_datetime(start)
end = pd.to_datetime(end)
# Read data
data = yf.download(symbol,start,end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment