-
Notifications
You must be signed in to change notification settings - Fork 18
/
Binance_Scan_Tickers_Growing.py
76 lines (63 loc) · 3.14 KB
/
Binance_Scan_Tickers_Growing.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from datetime import datetime
import ccxt
import time
import os
print('CCXT Version:', ccxt.__version__)
def log_to_results(str_to_log):
fr = open("scan_growing_results.txt", "a")
fr.write(str_to_log + "\n")
fr.close()
if os.path.exists("scan_growing_results.txt"):
os.remove("scan_growing_results.txt")
exchange = ccxt.binance({
'apiKey': '',
'secret': '',
'enableRateLimit': True, # https://github.com/ccxt/ccxt/wiki/Manual#rate-limit
'options': {
'defaultType': 'spot',
'adjustForTimeDifference': True,
},
})
exchange.set_sandbox_mode(False) # comment if you're not using the testnet
markets = exchange.load_markets()
exchange.verbose = False # debug output
percent = 1
#array_watch = {"VET/USDT": 0.02749, "BTC/USDT": 23000, "BAT/USDT": 0.4139}
#array_watch = {"VET/USDT": 0.02749, "BTC/USDT": 23000, "BAT/USDT": 0.4139}
array_watch = {}
array_count = {}
array_t0 = {}
array_datetime = {}
time.sleep(0.1)
tickers = exchange.fetch_tickers()
for item in tickers.items():
symbol = item[0]
#if str(symbol).endswith("/USDT"):
bid = tickers[symbol]['bid'] # prix de vente (sell)
ask = tickers[symbol]['ask'] # prix d'achat (buy)
if ask > 0:
array_watch[symbol] = ask + ask/100*percent
array_t0[symbol] = ask
array_datetime[symbol] = datetime.now()
print("adding", symbol, "with target buy price", array_watch[symbol], "current price being", ask)
array_count[symbol] = 0
while True:
tickers = exchange.fetch_tickers()
for item in tickers.items():
symbol = item[0]
for symbol_to_watch, value_to_watch in array_watch.items():
if symbol_to_watch == symbol:
bid = tickers[symbol]['bid'] # prix de vente (sell)
ask = tickers[symbol]['ask'] # prix d'achat (buy)
if ask > value_to_watch:
array_count[symbol] = array_count[symbol] + 1
array_watch[symbol_to_watch] = ask# + ask/100*percent
timedelta = datetime.now() - array_datetime[symbol]
# evol_pourcent = ask / array_t0[symbol]
evol_pourcent = ((ask - array_t0[symbol]) / array_t0[symbol]) * 100
percent_per_second = evol_pourcent / timedelta.total_seconds()
str_lien = "https://tradingview.com/chart/?symbol=BINANCE%3A" + symbol.replace('/', '')
print(array_count[symbol_to_watch], symbol_to_watch, ">=", value_to_watch, "increasing value to watch for", symbol, "to", array_watch[symbol_to_watch], str_lien, "evol/t0", "{:.2f}".format(evol_pourcent) + "%", "diff(t-t0)", timedelta, "%/sec", "{:.4f}".format(percent_per_second))
log_to_results(str(array_count[symbol_to_watch]) + " " + symbol_to_watch + " "+ ">=" + " " + str(value_to_watch) + " " + "increasing value to watch for" + " " + symbol + " " + "to" + " " + str(array_watch[symbol_to_watch]) + " " + str_lien + " " + "evol/t0" + " " + "{:.2f}".format(evol_pourcent) + "%" + " " + "diff(t-t0)" + " " + str(timedelta) + "%/sec" + " " + "{:.4f}".format(percent_per_second))
#beep.beep(1)
exit(-3)