Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,41 @@
|
|
1 |
import streamlit as st
|
2 |
from thronetrader import StrategicSignals
|
|
|
|
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
def main():
|
5 |
st.title("Strategic Trading Signals")
|
6 |
|
|
|
1 |
import streamlit as st
|
2 |
from thronetrader import StrategicSignals
|
3 |
+
import requests
|
4 |
+
import pandas as pd
|
5 |
|
6 |
+
# Hard-coded API key for demonstration purposes
|
7 |
+
API_KEY = "QR8F9B7T6R2SWTAT"
|
8 |
+
|
9 |
+
def fetch_alpha_vantage_data(api_key):
|
10 |
+
url = f'https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&apikey={api_key}'
|
11 |
+
response = requests.get(url)
|
12 |
+
alpha_vantage_data = response.json()
|
13 |
+
return alpha_vantage_data
|
14 |
+
|
15 |
+
def main():
|
16 |
+
st.title("Stock Trend Predictor")
|
17 |
+
|
18 |
+
# Use the hard-coded API key
|
19 |
+
api_key = API_KEY
|
20 |
+
|
21 |
+
# Fetch Alpha Vantage data
|
22 |
+
alpha_vantage_data = fetch_alpha_vantage_data(api_key)
|
23 |
+
|
24 |
+
# Extract relevant data from Alpha Vantage response
|
25 |
+
alpha_vantage_time_series = alpha_vantage_data.get('Time Series (5min)', {})
|
26 |
+
df = pd.DataFrame(alpha_vantage_time_series).T
|
27 |
+
df.index = pd.to_datetime(df.index)
|
28 |
+
df = df.dropna(axis=0)
|
29 |
+
|
30 |
+
# Print DataFrame for observation
|
31 |
+
st.subheader("Raw Data:")
|
32 |
+
st.write(df)
|
33 |
+
|
34 |
+
# Uncomment the next line if you want to stop the execution here to observe the data
|
35 |
+
# st.stop()
|
36 |
+
|
37 |
+
if __name__ == "__main__":
|
38 |
+
main()
|
39 |
def main():
|
40 |
st.title("Strategic Trading Signals")
|
41 |
|