Update app.py
Browse files
app.py
CHANGED
@@ -77,7 +77,7 @@ if __name__ == "__main__":
|
|
77 |
|
78 |
|
79 |
def fetch_alpha_vantage_data(api_key, symbol):
|
80 |
-
url = f'https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol={
|
81 |
response = requests.get(url)
|
82 |
alpha_vantage_data = response.json()
|
83 |
return alpha_vantage_data
|
@@ -95,9 +95,9 @@ def main():
|
|
95 |
st.title("AI Stock Trend Predictor")
|
96 |
|
97 |
# User input for stock symbol
|
98 |
-
|
99 |
|
100 |
-
if not
|
101 |
st.warning("Please enter a valid stock symbol.")
|
102 |
st.stop()
|
103 |
|
@@ -105,7 +105,7 @@ def main():
|
|
105 |
api_key = API_KEY
|
106 |
|
107 |
# Fetch Alpha Vantage data
|
108 |
-
alpha_vantage_data = fetch_alpha_vantage_data(api_key,
|
109 |
|
110 |
# Extract relevant data from Alpha Vantage response
|
111 |
alpha_vantage_time_series = alpha_vantage_data.get('Time Series (5min)', {})
|
|
|
77 |
|
78 |
|
79 |
def fetch_alpha_vantage_data(api_key, symbol):
|
80 |
+
url = f'https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol={symbol}&interval=5min&apikey={api_key}'
|
81 |
response = requests.get(url)
|
82 |
alpha_vantage_data = response.json()
|
83 |
return alpha_vantage_data
|
|
|
95 |
st.title("AI Stock Trend Predictor")
|
96 |
|
97 |
# User input for stock symbol
|
98 |
+
symbol = st.text_input("Enter Stock Symbol (e.g., IBM):",key="symbol")
|
99 |
|
100 |
+
if not symbol:
|
101 |
st.warning("Please enter a valid stock symbol.")
|
102 |
st.stop()
|
103 |
|
|
|
105 |
api_key = API_KEY
|
106 |
|
107 |
# Fetch Alpha Vantage data
|
108 |
+
alpha_vantage_data = fetch_alpha_vantage_data(api_key, symbol)
|
109 |
|
110 |
# Extract relevant data from Alpha Vantage response
|
111 |
alpha_vantage_time_series = alpha_vantage_data.get('Time Series (5min)', {})
|