Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -109,8 +109,6 @@ def calculate_entry_exit_points(symbol, target_profit_price, risk_percentage, ac
|
|
109 |
account_balance = float(account_balance)
|
110 |
buy_signal = buy_signal_str == "Buy"
|
111 |
print("buy_signal:", buy_signal)
|
112 |
-
|
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)
|
@@ -181,7 +179,10 @@ def calculate_take_profit(target_price, fibonacci_levels, buy_signal):
|
|
181 |
closest_levels = {k: v for k, v in fibonacci_levels.items() if v < target_price}
|
182 |
print("Closest Levels:")
|
183 |
print(closest_levels)
|
184 |
-
|
|
|
|
|
|
|
185 |
|
186 |
take_profit = closest_levels[take_profit_fibonacci_level]
|
187 |
|
|
|
109 |
account_balance = float(account_balance)
|
110 |
buy_signal = buy_signal_str == "Buy"
|
111 |
print("buy_signal:", buy_signal)
|
|
|
|
|
112 |
|
113 |
# Fetch swing high and swing low using symbol, interval, and start date
|
114 |
swing_high, swing_low = get_swing_high_low(symbol, 'intraday', start_date)
|
|
|
179 |
closest_levels = {k: v for k, v in fibonacci_levels.items() if v < target_price}
|
180 |
print("Closest Levels:")
|
181 |
print(closest_levels)
|
182 |
+
if closest_levels:
|
183 |
+
take_profit_fibonacci_level = min(closest_levels.keys())
|
184 |
+
else:
|
185 |
+
take_profit_fibonacci_level = 0
|
186 |
|
187 |
take_profit = closest_levels[take_profit_fibonacci_level]
|
188 |
|