Elizesel commited on
Commit
ebfdd5b
·
verified ·
1 Parent(s): 60a2fb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -25
app.py CHANGED
@@ -1,25 +1,15 @@
1
- def final_decision(ote, current_price, hist_high=None, hist_low=None, ml_dir=None):
2
- if ote is None:
3
- return "⚠️ НЕТ OTE — ждём сильную свечу на H4"
4
- if 'direction' not in ote:
5
- return "⚠️ ОШИБКА OTE — некорректные данные"
6
- targets_hit = False
7
- if ote['direction'] == "LONG" and hist_high is not None:
8
- if hist_high >= ote.get('ote_2618', 0):
9
- targets_hit = True
10
- elif ote['direction'] == "SHORT" and hist_low is not None:
11
- if hist_low <= ote.get('ote_2618', float('inf')):
12
- targets_hit = True
13
- ote_62 = ote.get('ote_62', 0)
14
- ote_79 = ote.get('ote_79', 0)
15
- if ote['direction'] == "LONG":
16
- entry_zone = current_price <= ote_79
17
- else:
18
- entry_zone = current_price >= ote_79
19
- if targets_hit and not entry_zone:
20
- return f"ЖДАТЬ ОТКАТА В OTE ({ote_62:.0f}-{ote_79:.0f}) — цели достигнуты"
21
- if targets_hit and entry_zone:
22
- return f"ГОТОВИТЬСЯ К ПОВТОРНОМУ ВХОДУ {ote['direction']} от {ote_62:.0f}-{ote_79:.0f}"
23
- if entry_zone:
24
- return f"{ote['direction']} от {ote_62:.0f}-{ote_79:.0f}"
25
- return f"ЖДАТЬ ВХОДА — цена не в OTE зоне ({ote_62:.0f}-{ote_79:.0f})"
 
1
+ import urllib.request
2
+
3
+ # В конце цикла, перед time.sleep, добавим периодический пинг
4
+ def keep_alive():
5
+ while True:
6
+ time.sleep(60) # каждую минуту
7
+ try:
8
+ urllib.request.urlopen('http://localhost:7860/ping')
9
+ print(f"💓 Self-ping: {datetime.now().strftime('%H:%M:%S')}", flush=True)
10
+ except:
11
+ pass
12
+
13
+ # Запускаем поток для пинга
14
+ ping_thread = threading.Thread(target=keep_alive, daemon=True)
15
+ ping_thread.start()