-
Notifications
You must be signed in to change notification settings - Fork 0
/
alert_levels_tg.py
50 lines (46 loc) · 1.69 KB
/
alert_levels_tg.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
def get_volume_alert_details(curr_volume, prev_volume_mean, symbol, interval, exchange):
details = []
base_url = {
"KUCOIN": "https://www.tradingview.com/chart/?symbol=KUCOIN:",
"BINANCE": "https://www.tradingview.com/chart/?symbol=BINANCE:"
}
if exchange.upper() not in base_url:
raise ValueError(f"Exchange {exchange} not supported.")
chart_url = f"{base_url[exchange.upper()]}{symbol}&interval={interval}"
if curr_volume > prev_volume_mean * 15:
details.append({
"level": "1500%+",
"curr_volume": curr_volume,
"prev_volume_mean": prev_volume_mean,
"symbol": symbol,
"interval": interval,
"chart_url": chart_url
})
elif curr_volume > prev_volume_mean * 10:
details.append({
"level": "1000%+",
"curr_volume": curr_volume,
"prev_volume_mean": prev_volume_mean,
"symbol": symbol,
"interval": interval,
"chart_url": chart_url
})
elif curr_volume > prev_volume_mean * 7:
details.append({
"level": "700%+",
"curr_volume": curr_volume,
"prev_volume_mean": prev_volume_mean,
"symbol": symbol,
"interval": interval,
"chart_url": chart_url
})
elif curr_volume > prev_volume_mean * 5:
details.append({
"level": "500%+",
"curr_volume": curr_volume,
"prev_volume_mean": prev_volume_mean,
"symbol": symbol,
"interval": interval,
"chart_url": chart_url
})
return details