Update app.py
Browse files
app.py
CHANGED
@@ -26,23 +26,22 @@ def main():
|
|
26 |
# Use the hard-coded API key
|
27 |
api_key = API_KEY
|
28 |
|
29 |
-
#
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
time.sleep(60) # Sleep for 60 seconds (adjust as needed)
|
46 |
|
47 |
if __name__ == "__main__":
|
48 |
main()
|
|
|
26 |
# Use the hard-coded API key
|
27 |
api_key = API_KEY
|
28 |
|
29 |
+
# Fetch Alpha Vantage data
|
30 |
+
alpha_vantage_data = fetch_alpha_vantage_data(api_key, symbol)
|
31 |
+
|
32 |
+
# Extract relevant data from Alpha Vantage response
|
33 |
+
alpha_vantage_quote = alpha_vantage_data.get('Global Quote', {})
|
34 |
+
df = pd.DataFrame([alpha_vantage_quote])
|
35 |
+
df.index = [datetime.now()] # Use the current timestamp as the index
|
36 |
+
df = df.dropna(axis=0)
|
37 |
+
|
38 |
+
# Display the real-time data
|
39 |
+
st.subheader("Real-Time Data:")
|
40 |
+
st.write(df)
|
41 |
+
|
42 |
+
# Notify user and stop the app
|
43 |
+
st.balloons()
|
44 |
+
st.stop()
|
|
|
45 |
|
46 |
if __name__ == "__main__":
|
47 |
main()
|