

# https://dexscreener.com/solana?rankBy=trendingScoreH24&order=desc&minLiq=50000&minAge=36

# 将油猴脚本获取的top trader
from base_class import BaseVariableFunction
from base_class import *
baseclass = BaseVariableFunction(__file__)

old_print = print


def timestamped_print(*args, **kwargs):
    old_print(datetime.datetime.utcnow().replace(
        microsecond=0), *args, **kwargs)


print = timestamped_print
 
baseclass.makedirpath(baseclass.dalao_tran_defined_path)
baseclass.makedirpath(baseclass.dalao_merge_defined_path)

 

print('\n'*5)
print(f"{'{:<6}'.format('ENTER')} {baseclass.scriptfilename} ----------------NOTE-----------NOTE---------------")

def makescreenurl( urlname,urlparam):
    _url = urlname + urlparam
    return '=HYPERLINK("{}","{}")'.format(_url, _url)

 
        
import re
def filter_simple_dalao():

    global arr_token_address
    df = None

    for tokenadd in arr_token_address:
 
        cur_df =  pd.read_excel(
        baseclass.dalao_tran_defined_path / f"{tokenadd}_defined.xlsx", dtype=object)
        cur_df=cur_df.astype({
            "buy_counts":int,
            "isNormal":int,
        })
        
        cur_df = cur_df[cur_df["buy_counts"]<=2].reset_index(drop=True)
        df = pd.concat([  df,cur_df  ], ignore_index=True)
   
        df =df.drop_duplicates(subset=["MAKER"]).reset_index(drop=True)
   
    df =df[[
        "MAKER"
    ]]
    df.columns=["dalaoaddress"]
    df =df.drop_duplicates(subset=["dalaoaddress"]).reset_index(drop=True)
    df["eth"] = -1
    df["usdc"] = -1
    df["usdt"] = -1
    df.to_excel(baseclass.dalao_merge_defined_path /  f"ori_merge_defined.xlsx",index=False )
        
 
    return

token_file_list = [f for f in os.listdir(
    baseclass.dalao_tran_defined_path) if f.endswith(".xlsx") ]
arr_token_address = [tokenadd.split("_")[0] for tokenadd in token_file_list  ]
arr_token_address=list(set(arr_token_address))



print("arr_token_address= ",arr_token_address)
 
filter_simple_dalao()

print(f"{'{:<6}'.format('END')} {baseclass.scriptfilename} ----------------NOTE-----------NOTE---------------")
