forked from alex-bormotov/AXE-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathignore_signals.py
60 lines (47 loc) · 1.78 KB
/
ignore_signals.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import time
from time import sleep
from notification import notificator
from config import get_config
ignore_buy_signal_counter = 0
ignore_sell_signal_counter = 0
def ignore_buy_signal_times(signal, times):
global ignore_buy_signal_counter
if signal["signal"] == "BUY" and ignore_buy_signal_counter < times:
notificator(
"Ignore {} {} ... cooldown {} seconds".format(
signal["signal"],
str(ignore_buy_signal_counter + 1),
get_config()["ignore_buy_cooldown_sec"],
)
)
ignore_buy_signal_counter = ignore_buy_signal_counter + 1
time.sleep(int(get_config()["ignore_buy_cooldown_sec"]))
return "PASS"
else:
notificator("Execute {}".format(signal["signal"]))
ignore_buy_signal_counter = 0
return "OK"
def ignore_sell_signal_times(signal, times):
global ignore_sell_signal_counter
if signal["signal"] == "SELL" and ignore_sell_signal_counter < times:
notificator(
"Ignore {} {} ... cooldown {} seconds".format(
signal["signal"],
str(ignore_sell_signal_counter + 1),
get_config()["ignore_sell_cooldown_sec"],
)
)
ignore_sell_signal_counter = ignore_sell_signal_counter + 1
time.sleep(int(get_config()["ignore_sell_cooldown_sec"]))
return "PASS"
else:
notificator("Execute {}".format(signal["signal"]))
ignore_sell_signal_counter = 0
return "OK"
def ingnore_signal_time(signal, time_sec):
notificator(
"{} signal received, sleep {} sec ...".format(signal["signal"], time_sec)
)
time.sleep(time_sec)
notificator("Execute {}, after sleep {} sec ".format(signal["signal"], time_sec))
return signal