-
Notifications
You must be signed in to change notification settings - Fork 16
/
FTX_Scan_Growing_Symbols.py
46 lines (35 loc) · 1.2 KB
/
FTX_Scan_Growing_Symbols.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
from datetime import datetime
import ftx
import pandas as pd
import requests
import threading
client = ftx.FtxClient(
api_key='',
api_secret='',
subaccount_name=''
)
result = client.get_balances()
symbolInfoInit = {}
symbolInfo = {}
symbolEvol = {}
initial_time = datetime.now()
stop_thread = False
def my_thread(name):
global symbolInfo, symbolInfoInit, symbolEvol, stop_thread
while not stop_thread:
markets = requests.get('https://ftx.com/api/markets').json()
df = pd.DataFrame(markets['result'])
df.set_index('name')
for index, row in df.iterrows():
symbol = row['name']
price = float(row['last'])
if symbol in symbolInfo:
if price > symbolInfo[symbol]:
symbolInfo[symbol] = price
print(datetime.now(), "growing", symbol, "evol=", price/symbolInfoInit[symbol], "init price=", symbolInfoInit[symbol], "current price=", price, "scan time=", datetime.now() - initial_time)
else:
symbolInfoInit[symbol] = price
symbolInfo[symbol] = price
stop_thread = False
x = threading.Thread(target=my_thread, args=(1,))
x.start()