GoshawkVortexAI commited on
Commit
59692d0
·
verified ·
1 Parent(s): f0c90e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -203,13 +203,22 @@ async def run_async(symbol, timeframe, exchange, horizon, limit):
203
  return ohlcv, deep, ind
204
 
205
 
 
 
 
 
 
 
 
206
  def run(symbol, timeframe, exchange, horizon, limit):
207
  try:
208
  ohlcv, deep, ind = asyncio.run(run_async(symbol, timeframe, exchange, horizon, limit))
209
  df = to_df(ohlcv)
210
  res = predict(df, int(horizon))
211
- except Exception as e: # noqa: BLE001
212
- return f"**Hata:** {e}", None, ""
 
 
213
 
214
  p = res["p_up"]
215
  signal = "LONG" if p > 0.55 else "SHORT" if p < 0.45 else "NÖTR"
 
203
  return ohlcv, deep, ind
204
 
205
 
206
+ def _root(e):
207
+ """ExceptionGroup/TaskGroup sarmalını açıp asıl hatayı döndürür."""
208
+ while getattr(e, "exceptions", None):
209
+ e = e.exceptions[0]
210
+ return f"{type(e).__name__}: {e}"
211
+
212
+
213
  def run(symbol, timeframe, exchange, horizon, limit):
214
  try:
215
  ohlcv, deep, ind = asyncio.run(run_async(symbol, timeframe, exchange, horizon, limit))
216
  df = to_df(ohlcv)
217
  res = predict(df, int(horizon))
218
+ except BaseException as e: # noqa: BLE001
219
+ import traceback
220
+ traceback.print_exc()
221
+ return f"**Hata:** {_root(e)}", None, ""
222
 
223
  p = res["p_up"]
224
  signal = "LONG" if p > 0.55 else "SHORT" if p < 0.45 else "NÖTR"