File size: 1,443 Bytes
abbc24d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import requests
import pandas as pd
import time

API_URL = "https://api.coingecko.com/api/v3"

def float_to_hex(f):
    _, hex_representation = f.hex().split('x')
    return "0x" + hex_representation

def get_new_tokens():
    response = requests.get(f"{API_URL}/coins/ethereum/market_chart", params={"vs_currency": "usd", "days": 1})
    data = response.json()
    
    new_tokens = []
    for token in data["market_caps"]:
        timestamp, market_cap = token
        if market_cap > 20000:
            coin_token = data["prices"][data["market_caps"].index(token)][1]
            coin_token_hex = float_to_hex(coin_token)
            new_tokens.append((coin_token_hex, timestamp, market_cap))
    
    new_tokens.sort(key=lambda x: x[1], reverse=True)
    
    return new_tokens

if __name__ == "__main__":
    while True:
        new_tokens = get_new_tokens()
        if new_tokens:
            print("New Ethereum Tokens Created in the Last 24 Hours (Market Cap > $20,000)")
            for coin_token, timestamp, market_cap in new_tokens:
                time_created = pd.to_datetime(timestamp, unit="ms").strftime("%H:%M:%S")
                print(f"COIN: {coin_token}, TIME CREATED: {time_created}, MARKET CAP: ${market_cap/1e6:.1f}MM")
        else:
            print("No new Ethereum tokens with market cap > $20,000 created in the last 24 hours.")
        
        # Wait for 60 seconds before updating again
        time.sleep(60)