Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -73,7 +73,7 @@ def fetch_historical_data(symbol, interval, output_size='compact', start_date=No
|
|
73 |
|
74 |
import numpy as np
|
75 |
|
76 |
-
def calculate_support_resistance_levels(symbol, interval='
|
77 |
# Fetch historical price data from AlphaVantage
|
78 |
historical_data = fetch_historical_data(symbol, interval, output_size)
|
79 |
|
@@ -113,13 +113,13 @@ def calculate_entry_exit_points(symbol, target_profit_price, risk_percentage, ac
|
|
113 |
|
114 |
|
115 |
# Fetch swing high and swing low using symbol, interval, and start date
|
116 |
-
swing_high, swing_low = get_swing_high_low(symbol, '
|
117 |
|
118 |
# Calculate Fibonacci levels
|
119 |
fibonacci_levels = calculate_fibonacci_retracements(swing_high, swing_low)
|
120 |
|
121 |
# Calculate support and resistance levels
|
122 |
-
support_level, resistance_level = calculate_support_resistance_levels(symbol, '
|
123 |
|
124 |
# Calculate entry and stop loss based on support and resistance
|
125 |
entry_point, stop_loss = calculate_entry_stop_loss(support_level, resistance_level, buy_signal)
|
|
|
73 |
|
74 |
import numpy as np
|
75 |
|
76 |
+
def calculate_support_resistance_levels(symbol, interval='intraday', output_size='compact'):
|
77 |
# Fetch historical price data from AlphaVantage
|
78 |
historical_data = fetch_historical_data(symbol, interval, output_size)
|
79 |
|
|
|
113 |
|
114 |
|
115 |
# Fetch swing high and swing low using symbol, interval, and start date
|
116 |
+
swing_high, swing_low = get_swing_high_low(symbol, 'intraday', start_date)
|
117 |
|
118 |
# Calculate Fibonacci levels
|
119 |
fibonacci_levels = calculate_fibonacci_retracements(swing_high, swing_low)
|
120 |
|
121 |
# Calculate support and resistance levels
|
122 |
+
support_level, resistance_level = calculate_support_resistance_levels(symbol, 'intraday', start_date)
|
123 |
|
124 |
# Calculate entry and stop loss based on support and resistance
|
125 |
entry_point, stop_loss = calculate_entry_stop_loss(support_level, resistance_level, buy_signal)
|