-
Notifications
You must be signed in to change notification settings - Fork 4
/
token_data.py
51 lines (40 loc) · 1.49 KB
/
token_data.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
import httpx
import time
def getdata(token):
url = "https://multichain-api.birdeye.so/solana/token/tokensecurity?token=" + token
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0",
"Accept": "application/json, text/plain, */*",
"Accept-Language": "en-US,en;q=0.5",
"agent-id": "43514db9-66d4-4715-9e21-25c054bwa93b",
"Sec-Fetch-Site": "same-site",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "https://birdeye.so/",
"Connection": "keep-alive",
"Origin": "https://birdeye.so",
}
resp = httpx.get(url, headers=headers)
data = resp.json()["data"]["result"]["data"]
liquidity = None
price = None
mut = str(data["mutable_metadata"])
mint = str(data["mintable"])
ownership = str(data["renounce"])
print(f"{mut} {mint} {ownership}")
resp = httpx.get(
"https://multichain-api.birdeye.so/solana/overview/token?address=" + token,
headers=headers,
).json()["data"]
if "liquidity" in list(resp.keys()):
liquidity = resp["liquidity"]
if "price" in list(resp.keys()):
price = resp["price"]
return mut, mint, ownership, liquidity, price
def x():
for values in httpx.get("http://localhost:5000/new_tokens").json():
a, b, c, d, e = getdata(values)
print(a, b, c, d, e)
while True:
x()
time.sleep(10)