Facebook
From Small Mousedeer, 1 Year ago, written in Plain Text.
This paste is a reply to Untitled from Silly Dormouse - go back
Embed
Viewing differences between Untitled and Re: Untitled
import json
from pprint import pprint
import re

import requests

_ = "dupa"

pattern = re.compile("(.)?([A-Z]*[a-z]+)( [A-Z]*[a-z]+){0,2}")
patterns = ["Bitcoin", "Meta", "Dog", "Doge", "Ape", "Elon", "Cat", "NFT", "Shiba", "Inu", "Baby", "Moon", "Safe",
            "Social", "Game", "Dollar", "USD", "Stable", "Fan", "Wallet", "League", "Land", "World", "Swap",
            "Pay", "Club", "Fun", "Sport", "Space", "Cube", "Tether"]

# current = open("all").read().strip().split()

x = json.load(open("allgekoncoins.txt"))

print(len(x))
# x = [i for i in x if i["id"] in current]
x = [i for i in x if pattern.match(i["name"]) and len(pattern.match(i["name"])[0]) == len(i["name"])]
x = [i for i in x if sum([1 for p in patterns if sum([1 for j in i["name"].split(" ") if j.lower().startswith(p.lower()) or j.lower().endswith(p.lower())]) != 0]) == 0]

ids = ",".join([i["id"] for i in x])
r = ""
while 1:
    ids = ids.split(",")

    print(len(ids))

    if len(ids) <= 678:
        ids2 = None
        ids = ",".join(ids)
    else:
        ids2 = ",".join(ids[678:])
        ids = ",".join(ids[:678])

    data = requests.get(f"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids={ids}").text

    data = json.loads(data)

    data = [i for i in data if i["circulating_supply"] and i["ath"] and i["ath_change_percentage"]
            and i["circulating_supply"]*i["ath"] < 200000 and i["ath_change_percentage"] > -90
            and i["market_cap"] and 4000 < i["market_cap"] < 50000 and i["market_cap_rank"] and i["id"] and i["name"] and i["current_price"] and \
        i["price_change_percentage_24h"] and i["high_24h"] and i["low_24h"] and \
        i["market_cap"] and i["total_volume"] and 1000000 < i["circulating_supply"] < 1000000000000]

    r += ","
    r += ",".join([i["id"] for i in data])

    if ids2 is None:
        break

    ids = ids2

r = r[1:]

print(r)
print(len(r.split(",")))