Geek7 commited on
Commit
614192d
·
verified ·
1 Parent(s): 821ca80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -16
app.py CHANGED
@@ -72,10 +72,9 @@ def main():
72
  rsi_signals = strategic_signals.get_rsi_signals()
73
  st.write(rsi_signals)
74
 
75
- if __name__ == "__main__":
76
- main()
77
 
78
 
 
79
 
80
  def fetch_alpha_vantage_data(api_key, symbol):
81
  url = f'https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol={symbol}&interval=5min&apikey={api_key}'
@@ -92,25 +91,12 @@ def calculate_indicators(data):
92
  data['Inside'] = (data['High'] < data['High'].shift(1)) & (data['Low'] > data['Low'].shift(1))
93
  return data
94
 
95
- def main():
96
- st.title("AI Stock Trend Predictor")
97
-
98
- # Input for stock symbol
99
- symbol2 = st.text_input("Enter stock symbol (e.g., AAPL):", "AAPL",key="symbol2")
100
-
101
- def fetch_alpha_vantage_data(api_key, symbol2):
102
- url = f'https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol2={symbol2}&interval=5min&apikey={api_key}'
103
- response = requests.get(url)
104
- alpha_vantage_data = response.json()
105
- return alpha_vantage_data
106
-
107
-
108
 
109
  # Use the hard-coded API key
110
  api_key = API_KEY
111
 
112
  # Fetch Alpha Vantage data
113
- alpha_vantage_data = fetch_alpha_vantage_data(api_key, symbol2)
114
 
115
  # Extract relevant data from Alpha Vantage response
116
  alpha_vantage_time_series = alpha_vantage_data.get('Time Series (5min)', {})
 
72
  rsi_signals = strategic_signals.get_rsi_signals()
73
  st.write(rsi_signals)
74
 
 
 
75
 
76
 
77
+ st.title("AI Stock Trend Predictor")
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}'
 
91
  data['Inside'] = (data['High'] < data['High'].shift(1)) & (data['Low'] > data['Low'].shift(1))
92
  return data
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
  # Use the hard-coded API key
96
  api_key = API_KEY
97
 
98
  # Fetch Alpha Vantage data
99
+ alpha_vantage_data = fetch_alpha_vantage_data(api_key, symbol)
100
 
101
  # Extract relevant data from Alpha Vantage response
102
  alpha_vantage_time_series = alpha_vantage_data.get('Time Series (5min)', {})