Spaces:
Running
Running
import streamlit as st | |
import yfinance as yf | |
import pandas as pd | |
from datetime import datetime, timedelta | |
def get_stock_data(symbol): | |
"""Fetch stock data from Yahoo Finance""" | |
end_date = datetime.now() | |
start_date = end_date - timedelta(days=365) | |
stock = yf.Ticker(symbol) | |
df = stock.history(start=start_date, end=end_date) | |
return df | |
def get_company_info(symbol): | |
"""Fetch company information""" | |
stock = yf.Ticker(symbol) | |
return stock.info |