
from base_class import BaseVariableFunction
from base_class import *

from base_library import BaseLibrary
old_print = print


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


print = timestamped_print
baseclass = BaseVariableFunction(__file__)

 
baseclass.makedirpath(baseclass.dalao_merge_path)
print('\n'*5)
print(f"{'{:<6}'.format('ENTER')} {baseclass.scriptfilename} ----------------NOTE-----------NOTE---------------")
            
arr_token_file = [file for file in os.listdir(baseclass.dalao_buysell_count_path) if file.endswith(".xlsx")]
print(arr_token_file)
# df =None
df =pd.DataFrame()

for file in arr_token_file:
    tokenaddress = file.replace(".xlsx","")
    dalao_count_df =pd.read_excel (baseclass.dalao_buysell_count_path / f"{file}",dtype=object)
    dalao_count_df["tokenaddress"] = tokenaddress
    df = pd.concat([df,dalao_count_df])
df =df.astype({
    "buy_count":int,
    "sell_count":int,
})
many_buy_txns_mask = (df["buy_count"]>=15  )
zero_buy_mask = (df["buy_count"]==0)
drop_mask = (many_buy_txns_mask | zero_buy_mask)

df=df[~drop_mask].reset_index(drop=True)
df =df.drop_duplicates(subset=["dalaoaddress"]).reset_index(drop=True)

df["eth"] = -1
df["weth"] = -1
df["usdt"] = -1
df["usdc"] = -1
df["iscontract"] = -1

df.to_csv(baseclass.dalao_merge_path/"ori_merge.csv",index=False)

    
    


  
             

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

