-
Notifications
You must be signed in to change notification settings - Fork 12
/
dumps.py
61 lines (51 loc) · 2.33 KB
/
dumps.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
61
from binance.client import Client
import talib
import pandas as pd
client = Client()
def get_usdt_coins():
symbols = []
hmpairs = []
tickers = client.get_all_tickers()
for x in tickers:
coin = x["symbol"]
if ("UP" in coin) or ("DOWN" in coin) or ("BULL" in coin) or ("BEAR" in coin) or ("NANO" in coin) or (
"BCC" in coin) or ("VEN" in coin):
continue
if coin.endswith("USDT"):
symbols.append(coin)
# print(dca_coins)
for symbol in symbols:
pair = symbol
candles = client.get_klines(symbol=pair, interval=Client.KLINE_INTERVAL_1HOUR)
onehour_df = pd.DataFrame(candles)
onehour_df.columns = ['Open time', 'Open', 'High', 'Low', 'Close', 'Volume', 'Close time', 'Quote asset volume',
'Number of trades', 'Taker buy base asset volume', 'Taker buy quote asset volume',
'Can be ignored']
onehour_df.Close = onehour_df.Close.astype(float)
onehour_df.High = onehour_df.High.astype(float)
onehour_df.Low = onehour_df.Low.astype(float)
# Calculate 20 smoothed moving average
onehour_df['sma'] = talib.SMA(onehour_df.Close, timeperiod=20)
twenty_sma = onehour_df['sma'].iloc[-1]
# Get Last/Current price
current_price = onehour_df['Close'].iloc[-1]
if current_price < twenty_sma:
# Calculate ATR
atr_df = talib.ATR(onehour_df.High, onehour_df.Low, onehour_df.Close, timeperiod=14)
atr = atr_df.iloc[-1]
cal_atr = round(((atr / current_price) * 100), 2)
if cal_atr > 3:
hmpairs.append(f"#{pair} with an HM of -{cal_atr}%")
if len(hmpairs) <= 25:
dca_coins = '\n'.join(map(str, hmpairs))
return f"Top Dumping Pairs \n {dca_coins}\n" \
f"[Join Our Telegram Channel](https://t.me/Zcryptochannel)\n" \
f"[Join Our Discord Server](https://discord.gg/RWtT7Nx9jh)\n"
elif len(hmpairs) >= 27:
new = hmpairs[0:25]
dca_coins = '\n'.join(map(str, new))
return f"Top Dumping Pairs \n {dca_coins}\n" \
f"[Join Our Telegram Channel](https://t.me/Zcryptochannel)\n" \
f"[Join Our Discord Server](https://discord.gg/RWtT7Nx9jh)\n"
else:
return f"NO DATA"