Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -277,8 +277,10 @@ async def run_unified_cycle():
|
|
| 277 |
logger.info(message)
|
| 278 |
log_buffer.write(message + '\n')
|
| 279 |
|
| 280 |
-
if sys_state.cycle_running or sys_state.training_running:
|
| 281 |
-
|
|
|
|
|
|
|
| 282 |
|
| 283 |
sys_state.set_cycle_start()
|
| 284 |
|
|
@@ -291,18 +293,19 @@ async def run_unified_cycle():
|
|
| 291 |
for sym, tr in trade_manager.open_positions.items():
|
| 292 |
curr_p = await data_manager.get_latest_price_async(sym)
|
| 293 |
entry_p = float(tr.get('entry_price', 0))
|
| 294 |
-
pnl = ((curr_p - entry_p)/entry_p)*100 if entry_p > 0 else 0
|
| 295 |
log_and_print(f" 🔒 {sym}: {pnl:+.2f}%")
|
| 296 |
|
| 297 |
# LAYER 1: Adaptive Screening
|
| 298 |
current_regime = getattr(SystemLimits, 'CURRENT_REGIME', 'UNKNOWN')
|
| 299 |
log_and_print(f" [1/5] 🔍 L1 Screening (Context Aware)...")
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
|
|
|
| 306 |
|
| 307 |
# LAYER 2: Deep Analysis
|
| 308 |
log_and_print(f" [2/5] 🧠 L2 Deep Analysis ({len(candidates)} items)...")
|
|
|
|
| 277 |
logger.info(message)
|
| 278 |
log_buffer.write(message + '\n')
|
| 279 |
|
| 280 |
+
if sys_state.cycle_running or sys_state.training_running:
|
| 281 |
+
return
|
| 282 |
+
if not sys_state.ready:
|
| 283 |
+
return
|
| 284 |
|
| 285 |
sys_state.set_cycle_start()
|
| 286 |
|
|
|
|
| 293 |
for sym, tr in trade_manager.open_positions.items():
|
| 294 |
curr_p = await data_manager.get_latest_price_async(sym)
|
| 295 |
entry_p = float(tr.get('entry_price', 0))
|
| 296 |
+
pnl = ((curr_p - entry_p) / entry_p) * 100 if entry_p > 0 else 0
|
| 297 |
log_and_print(f" 🔒 {sym}: {pnl:+.2f}%")
|
| 298 |
|
| 299 |
# LAYER 1: Adaptive Screening
|
| 300 |
current_regime = getattr(SystemLimits, 'CURRENT_REGIME', 'UNKNOWN')
|
| 301 |
log_and_print(f" [1/5] 🔍 L1 Screening (Context Aware)...")
|
| 302 |
+
|
| 303 |
+
# Pass adaptive_hub so DataManager can fetch DNA per coin
|
| 304 |
+
candidates = await data_manager.layer1_rapid_screening(adaptive_hub_ref=adaptive_hub)
|
| 305 |
+
if not candidates:
|
| 306 |
+
log_and_print("⚠️ No valid candidates found (Quality Filter).")
|
| 307 |
+
sys_state.set_cycle_end(logs=log_buffer.getvalue())
|
| 308 |
+
return
|
| 309 |
|
| 310 |
# LAYER 2: Deep Analysis
|
| 311 |
log_and_print(f" [2/5] 🧠 L2 Deep Analysis ({len(candidates)} items)...")
|